diff options
| author | OpportunityLiu <[email protected]> | 2019-06-18 18:10:48 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-06-18 18:10:48 +0800 |
| commit | 026a8aa6a02bf9c12790404b9c551abf3dfd261b (patch) | |
| tree | 13c9acd6bf397fbe8a1d0c121685693b9cffda34 /tests/modules/path/test.lua | |
| parent | 9c8b83a61fce275edd3808c54f36ba368378fa5d (diff) | |
fix find_program & find_file
add path.splitenv
Diffstat (limited to 'tests/modules/path/test.lua')
| -rw-r--r-- | tests/modules/path/test.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/modules/path/test.lua b/tests/modules/path/test.lua new file mode 100644 index 000000000..bba15810c --- /dev/null +++ b/tests/modules/path/test.lua @@ -0,0 +1,27 @@ +function test_splitenv_win(t) + if not is_host("windows") then + return + end + t:are_equal(path.splitenv(""), {}) + t:are_equal(path.splitenv("a"), {'a'}) + t:are_equal(path.splitenv("a;b"), {'a','b'}) + t:are_equal(path.splitenv(";;a;;b;"), {'a','b'}) + t:are_equal(path.splitenv('c:/a;c:\\b'), {'c:/a', 'c:\\b'}) + t:are_equal(path.splitenv('"a;aa;aa;;"'), {"a;aa;aa;;"}) + t:are_equal(path.splitenv('"a;aa;aa;;";bb;;'), {"a;aa;aa;;", 'bb'}) + t:are_equal(path.splitenv('"a;aa;aa;;";"a;cc;aa;;";bb;"d";'), {"a;aa;aa;;","a;cc;aa;;", 'bb', 'd' }) +end + +function test_splitenv_unix(t) + if is_host("windows") then + return + end + t:are_equal(path.splitenv(""), {}) + t:are_equal(path.splitenv("a"), {'a'}) + t:are_equal(path.splitenv("a:b"), {'a','b'}) + t:are_equal(path.splitenv("::a::b:"), {'a','b'}) + t:are_equal(path.splitenv('a%tag:b'), {'a','b'}) + t:are_equal(path.splitenv('a%tag:b%tag'), {'a','b'}) + t:are_equal(path.splitenv('a%tag:b%%tag%%'), {'a','b'}) + t:are_equal(path.splitenv('a%tag:b:%tag:'), {'a','b'}) +end
\ No newline at end of file |
