aboutsummaryrefslogtreecommitdiff
path: root/spec/fs_spec.lua
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-10-28 14:23:04 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-10-28 14:28:52 +0300
commit8630a263b6c5f86d57eb0f3a49ddce163c8378c1 (patch)
treee27533ad1e4263a7e62c0d41c10e8c6c9204d08a /spec/fs_spec.lua
parentf7ae6213f430798ec86883f9ab9917b156e1758d (diff)
downloadluarocks-8630a263b6c5f86d57eb0f3a49ddce163c8378c1.tar.gz
luarocks-8630a263b6c5f86d57eb0f3a49ddce163c8378c1.tar.bz2
luarocks-8630a263b6c5f86d57eb0f3a49ddce163c8378c1.zip
Add a few tests for fs.Q
Diffstat (limited to 'spec/fs_spec.lua')
-rw-r--r--spec/fs_spec.lua21
1 files changed, 21 insertions, 0 deletions
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 @@
1local test_env = require("test/test_environment")
2
3test_env.unload_luarocks()
4local fs = require("luarocks.fs")
5local is_win = test_env.TEST_TARGET_OS == "windows"
6
7describe("Luarocks fs test #whitebox #w_fs", function()
8 describe("fs.Q", function()
9 it("simple argument", function()
10 assert.are.same(is_win and '"foo"' or "'foo'", fs.Q("foo"))
11 end)
12
13 it("argument with quotes", function()
14 assert.are.same(is_win and [["it's \"quoting\""]] or [['it'\''s "quoting"']], fs.Q([[it's "quoting"]]))
15 end)
16
17 it("argument with special characters", function()
18 assert.are.same(is_win and [["\\"%" \\\\" \\\\\\"]] or [['\% \\" \\\']], fs.Q([[\% \\" \\\]]))
19 end)
20 end)
21end)