pwd.test 636 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. [ -f testing.sh ] && . testing.sh
  3. #testing "name" "command" "result" "infile" "stdin"
  4. #TODO: Find better tests
  5. testing "pwd" "[ $(stat -c %i "$(pwd)") = $(stat -c %i .) ] && echo yes" \
  6. "yes\n" "" ""
  7. testing "-P" "[ $(stat -c %i "$(pwd -P)") = $(stat -c %i .) ] && echo yes" \
  8. "yes\n" "" ""
  9. ln -s . sym
  10. cd sym
  11. testing "pwd" "[ $(stat -c %i "$(pwd)") = $(stat -c %i "$PWD") ] && echo yes" \
  12. "yes\n" "" ""
  13. testing "-P" "[ $(stat -c %i "$(pwd -P)") = $(stat -c %i "$PWD") ] || echo yes" \
  14. "yes\n" "" ""
  15. cd ..
  16. rm sym
  17. export PWD=walrus
  18. testing "(bad PWD)" "[ "$(pwd)" = "$(cd . ; pwd)" ] && echo yes" \
  19. "yes\n" "" ""