diff options
author | Felix Janda <felix.janda@posteo.de> | 2012-12-23 17:44:35 +0100 |
---|---|---|
committer | Felix Janda <felix.janda@posteo.de> | 2012-12-23 17:44:35 +0100 |
commit | c5b15dbd1aa21566417d606111b02e993069408c (patch) | |
tree | 2ff9805f3c53d49804513234e240a9c570583e1a /scripts/test | |
parent | 208f6c16e146a6745a45c3ec7e019a1d8cb7ade3 (diff) | |
download | toybox-c5b15dbd1aa21566417d606111b02e993069408c.tar.gz |
Add some tests for mkdir
Diffstat (limited to 'scripts/test')
-rw-r--r-- | scripts/test/mkdir.test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/test/mkdir.test b/scripts/test/mkdir.test new file mode 100644 index 00000000..035d6132 --- /dev/null +++ b/scripts/test/mkdir.test @@ -0,0 +1,44 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +testing "mkdir" "mkdir one && [ -d one ] && echo yes" "yes\n" "" "" +rmdir one + +touch existing +testing "mkdir existing" \ + "mkdir existing 2> /dev/null || [ -f existing ] && echo yes" "yes\n" "" "" +rm existing + +testing "mkdir one two" \ + "mkdir one two && [ -d one ] && [ -d two ] && echo yes" "yes\n" "" "" +rmdir one two + +testing "mkdir missing/one" \ + "mkdir missing/one 2> /dev/null || [ ! -d missing ] && echo yes" "yes\n" "" "" + +testing "mkdir -p" \ + "mkdir -p one/two/three && [ -d one/two/three ] && echo yes" "yes\n" "" "" +rm -rf one + +mkdir existing +testing "mkdir -p existing" "mkdir -p existing && echo yes" "yes\n" "" "" +rmdir existing + +umask 123 +testing "mkdir (default permissions)" \ + "mkdir one && stat -c %a one" "654\n" "" "" +rmdir one + +umask 000 + +testing "mkdir -m 124" \ + "mkdir -m 124 one && stat -c %a one" "124\n" "" "" +rmdir one + +testing "mkdir -p -m 653" \ + "mkdir -p -m 653 one/two && stat -c %a one && stat -c %a one/two" \ + "777\n653\n" "" "" +rm -rf one |