Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bats
  2. @test "task2: Check that we have a debug output" {
  3. run stat "$BATS_TEST_DIRNAME/../target/debug/task2"
  4. [ "$status" -eq 0 ]
  5. }
  6. @test "task2: Output Long String: The quick ...." {
  7. run "$BATS_TEST_DIRNAME/../target/debug/task2" 'q' '♥ The quick brown fox jumps over the lazy dog. ♥'
  8. [[ "${lines[0]}" =~ "You asked me to count all 'q' in '♥ The quick brown fox jumps over the lazy dog. ♥'" ]]
  9. [[ "${lines[1]}" =~ "Found 1 'q' in '♥ The quick brown fox jumps over the lazy dog. ♥'" ]]
  10. }
  11. @test "task2: Output Short String: ababab " {
  12. run "$BATS_TEST_DIRNAME/../target/debug/task2" 'a' 'ababab'
  13. [[ "${lines[0]}" =~ "You asked me to count all 'a' in 'ababab'" ]]
  14. [[ "${lines[1]}" =~ "Found 3 'a' in 'ababab'" ]]
  15. }
  16. @test "task2: Output Error 1" {
  17. run "$BATS_TEST_DIRNAME/../target/debug/task2"
  18. [[ "${lines[0]}" =~ "not enough arguments" ]]
  19. }
  20. @test "task2: Output Error 2" {
  21. run "$BATS_TEST_DIRNAME/../target/debug/task2"
  22. [[ "${lines[0]}" =~ "not enough arguments" ]]
  23. }
  24. # wc output with white spaces is trimmed by xargs
  25. @test "task2: Output must be exact 2 line long" {
  26. run bash -c "'$BATS_TEST_DIRNAME/../target/debug/task2' 'a' 'b' 'c' | wc -l | xargs"
  27. [ "$output" = "2" ]
  28. }
  29. # wc output with white spaces is trimmed by xargs
  30. @test "task2: Output must be exact 1 line long" {
  31. run bash -c "'$BATS_TEST_DIRNAME/../target/debug/task2' 'a' | wc -l | xargs"
  32. [ "$output" = "1" ]
  33. }