JAT - Just A Testing library https://pagure.io/shellfu-bash-jat

jattest 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. if ! test -f /var/tmp/jat/rebooted; then
  3. jat__cmp 0 eq 1
  4. jat__pstarts init
  5. jat__cmp -h "math works" \
  6. 0 eq 0
  7. jat__pend
  8. jat__pstartt
  9. jat__cmd true
  10. jat__cmd false
  11. jat__cmd -e 1 true
  12. jat__cmd -e 1 false
  13. jat__cmp 5 eq 3
  14. jat__cmp 5 gt 3
  15. jat__cmp foo re oo
  16. jat__cmp foo re '.*oo'
  17. jat__pass -h "so it looks fine"
  18. jat__fail -h "it still looks fine"
  19. jat__fail
  20. jat__pass
  21. jat__log_info "this is normal"
  22. jat__pend
  23. jat__pstartt beidz
  24. jat__cmd -b foo true
  25. jat__cmd -b foo2 false
  26. jat__pend
  27. jat__pstartt pre-reboot
  28. jat__cmd true
  29. touch /var/tmp/jat/rebooted
  30. jat__pend
  31. jat__log_info "rebooting"
  32. exit
  33. else
  34. jat__log_info "rebooted"
  35. jat__pstartt post-reboot
  36. rm /var/tmp/jat/rebooted
  37. jat__cmd true
  38. jat__pend
  39. fi
  40. # jat__pstartt "torture"
  41. # jat__cmd
  42. # jat__cmd -z zaza
  43. # jat__cmp foo bar baz
  44. # jat__cmp foo eq baz
  45. # jat__fail "heya"
  46. # jat__pass "hoya"
  47. # jat__log_error "this is not normal"
  48. # jat__pend