3
0

case1.tests 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. case w in a) echo SKIP;; w) echo OK_1;; w) echo WRONG;; esac
  2. case w in
  3. a) echo SKIP;;
  4. w)echo OK_1 ;;
  5. w)
  6. echo WRONG
  7. ;;
  8. esac
  9. t=w
  10. case $t in a) echo SKIP;; w) echo OK_21;; w) echo WRONG;; esac;
  11. case "$t" in a) echo SKIP;; w) echo OK_22;; w) echo WRONG;; esac;
  12. case w in a) echo SKIP;; $t) echo OK_23;; "$t") echo WRONG;; esac;
  13. case '' in a) echo SKIP;; w) echo WRONG;; *) echo OK_31;; esac;
  14. case '' in a) echo SKIP;; '') echo OK_32;; *) echo WRONG;; esac;
  15. case `echo w` in a) echo SKIP;; w) echo OK_41;; w) echo WRONG;; esac;
  16. case "`echo w`" in a) echo SKIP;; w) echo OK_42;; w) echo WRONG;; esac;
  17. case `echo w w` in a) echo SKIP;; w) echo WRONG;; 'w w') echo OK_43;; esac;
  18. case `echo w w` in a) echo SKIP;; w) echo WRONG;; w*) echo OK_44;; esac;
  19. case w in `echo w`) echo OK_51;; `echo WRONG >&2`w) echo WRONG;; esac;
  20. case w in `echo OK_52 >&2`) echo SKIP;; `echo`w) echo OK_53;; esac;
  21. # parsing cases in subshells can easily get messy
  22. case m in m) echo OK_sub1;; esac
  23. case m in (m) echo OK_sub2;; esac
  24. (case m in m) echo OK_sub3;; esac)
  25. (case m in (m) echo OK_sub4;; esac)
  26. (
  27. case m in m) echo OK_sub5;; esac
  28. )
  29. (
  30. case m in (m) echo OK_sub6;; esac
  31. )
  32. (case esac in "esac") echo OK_esac1;; esac)
  33. echo Done