From 8630a263b6c5f86d57eb0f3a49ddce163c8378c1 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Fri, 28 Oct 2016 14:23:04 +0300 Subject: Add a few tests for fs.Q --- spec/fs_spec.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/fs_spec.lua (limited to 'spec') diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua new file mode 100644 index 00000000..c76f47a4 --- /dev/null +++ b/spec/fs_spec.lua @@ -0,0 +1,21 @@ +local test_env = require("test/test_environment") + +test_env.unload_luarocks() +local fs = require("luarocks.fs") +local is_win = test_env.TEST_TARGET_OS == "windows" + +describe("Luarocks fs test #whitebox #w_fs", function() + describe("fs.Q", function() + it("simple argument", function() + assert.are.same(is_win and '"foo"' or "'foo'", fs.Q("foo")) + end) + + it("argument with quotes", function() + assert.are.same(is_win and [["it's \"quoting\""]] or [['it'\''s "quoting"']], fs.Q([[it's "quoting"]])) + end) + + it("argument with special characters", function() + assert.are.same(is_win and [["\\"%" \\\\" \\\\\\"]] or [['\% \\" \\\']], fs.Q([[\% \\" \\\]])) + end) + end) +end) -- cgit v1.2.3-55-g6feb