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/rmdir.testscript | 95 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tests/builtin/rmdir.testscript (limited to 'tests/builtin/rmdir.testscript') diff --git a/tests/builtin/rmdir.testscript b/tests/builtin/rmdir.testscript new file mode 100644 index 0000000..a63f701 --- /dev/null +++ b/tests/builtin/rmdir.testscript @@ -0,0 +1,95 @@ +# file : tests/builtin/rmdir.testscript +# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +test.arguments = "rmdir" +test.options += -c + +: unknown-option +: +rmdir -u 2>"rmdir: unknown option '-u'" == 1 + +: no-args +: +{ + : fail + : + : Removing with no arguments fails. + : + $* 2>"rmdir: missing directory" == 1 + + : force + : + : Removing with no arguments succeeds with -f option. + : + $* -f +} + +: dir +: +{ + : empty-path + : + : Removing an empty path fails. + : + $* '' 2>"rmdir: invalid path ''" == 1 + + : exists + : + : Removing existing directory succeeds. + : + { + mkdir a &!a; + + $* a >>/~%EOO% + %remove .+/a/ false true% + %remove .+/a/ false false% + EOO + } + + : not-exists + : + { + : fail + : Removing non-existing directory fails. + : + { + $* a >/~'%remove .+/a/ false true%' 2>>/~%EOE% == 1 + %rmdir: unable to remove '.+/a': .+% + EOE + } + + : force + : + : Removing non-existing directory succeeds with -f option. + : + $* -f a >>/~%EOO% + %remove .+/a/ true true% + %remove .+/a/ true false% + EOO + } + + : not-empty + : + : Removing non-empty directory fails. + : + { + mkdir -p a/b; + + $* a >/~'%remove .+/a/ false true%' 2>>/~%EOE% == 1 + %rmdir: unable to remove '.+/a': .+% + EOE + } + + : not-dir + : + : Removing not a directory path fails. + : + { + touch a; + + $* a >/~'%remove .+/a/ false true%' 2>>/~%EOE% == 1 + %rmdir: unable to remove '.+/a': .+% + EOE + } +} -- cgit v1.1