From 840ed125b4789e638a38cbc99667a8a4dcdeb2ce Mon Sep 17 00:00:00 2001 From: Felix Janda Date: Fri, 28 Dec 2012 22:10:21 +0100 Subject: Add some tests for pwd. --- scripts/test/pwd.test | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/test/pwd.test (limited to 'scripts/test') diff --git a/scripts/test/pwd.test b/scripts/test/pwd.test new file mode 100755 index 00000000..b02055b1 --- /dev/null +++ b/scripts/test/pwd.test @@ -0,0 +1,26 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +#TODO: Find better tests + +testing "pwd" "[ $(stat -c %i "$(pwd)") = $(stat -c %i .) ] && echo yes" \ + "yes\n" "" "" +testing "pwd -P" "[ $(stat -c %i "$(pwd -P)") = $(stat -c %i .) ] && echo yes" \ + "yes\n" "" "" + + +ln -s . sym +cd sym +testing "pwd" "[ $(stat -c %i "$(pwd)") = $(stat -c %i "$PWD") ] && echo yes" \ + "yes\n" "" "" +testing "pwd -P" "[ $(stat -c %i "$(pwd -P)") = $(stat -c %i "$PWD") ] || echo yes" \ + "yes\n" "" "" +cd .. +rm sym + +export PWD=walrus +testing "pwd (bad PWD)" "[ "$(pwd)" = "$(cd . ; pwd)" ] && echo yes" \ + "yes\n" "" "" -- cgit v1.2.3