From 1c6758009e82c47b5b341d418be2be401ef31482 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 6 Sep 2019 22:20:46 +0300 Subject: Add builtins support --- tests/builtin/mkdir.testscript | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 tests/builtin/mkdir.testscript (limited to 'tests/builtin/mkdir.testscript') 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 +} -- cgit v1.1