diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-09-06 22:20:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-09-27 17:08:05 +0300 |
commit | 1c6758009e82c47b5b341d418be2be401ef31482 (patch) | |
tree | d3ef8c053280477086f6230e3d25ff90b25871a2 /tests/builtin/mkdir.testscript | |
parent | 070871d97b4f6440c3f0fc647ece73b53a5837db (diff) |
Add builtins support
Diffstat (limited to 'tests/builtin/mkdir.testscript')
-rw-r--r-- | tests/builtin/mkdir.testscript | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/tests/builtin/mkdir.testscript b/tests/builtin/mkdir.testscript new file mode 100644 index 0000000..5225caa --- /dev/null +++ b/tests/builtin/mkdir.testscript @@ -0,0 +1,102 @@ +# file : tests/builtin/mkdir.testscript +# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +test.arguments = "mkdir" +test.options += -c + +: unknown-option +: +$* -u >'option -u' 2>"mkdir: unknown option '-u'" == 1 + +: parent +: +{ + $* -p a/b >>/~%EOO% &a/ &a/b/; + %create .+/a/ true% + %create .+/a/ false% + %create .+/a/b/ true% + %create .+/a/b/ false% + EOO + + touch a/a a/b/b +} + +: exists +: +{ + $* -p a a a/b a/b >>/~%EOO% &a/ &a/b/ + %create .+/a/ true% + %create .+/a/ false% + %create .+/a/b/ true% + %create .+/a/b/ false% + EOO +} + +: dirs +: +{ + $* a b >>/~%EOO% &a/ &b/; + %create .+/a/ true% + %create .+/a/ false% + %create .+/b/ true% + %create .+/b/ false% + EOO + + touch a/a b/b +} + +: double-dash +: +: Make sure '-p' directory is created. +: +{ + $* -p -- -p >>/~%EOO% &-p/; + %create .+/-p/ true% + %create .+/-p/ false% + EOO + + touch -- -p/a +} + +: no-args +: +: Test passing no arguments. +: +{ + $* 2>"mkdir: missing directory" == 1 +} + +: empty-path +: +: Test creation of empty directory path. +: +{ + $* '' 2>"mkdir: invalid path ''" == 1 +} + +: already-exists +: +: Test creation of an existing directory. +: +{ + $* a a >>/~%EOO% 2>>/~%EOE% &a/ == 1 + %create .+/a/ true% + %create .+/a/ false% + %create .+/a/ true% + EOO + %mkdir: unable to create directory '.+/a': .+% + EOE +} + +: not-exists +: +: Test creation of a directory with non-existent parent. +: +{ + $* a/b >>/~%EOO% 2>>/~%EOE% == 1 + %create .+/a/b/ true% + EOO + %mkdir: unable to create directory '.+/a/b': .+% + EOE +} |