exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

error_handling_test.sh (700B)


      1 #!/usr/bin/env bash
      2 
      3 @test "correct arguments" {
      4   run bash error_handling.sh Alice
      5 
      6   [ "$status" -eq 0 ]
      7   [ "$output" = "Hello, Alice" ]
      8 }
      9 
     10 @test "one long argument" {
     11   run bash error_handling.sh "Alice and Bob"
     12 
     13   [ "$status" -eq 0 ]
     14   [ "$output" = "Hello, Alice and Bob" ]
     15 }
     16 
     17 @test "incorrect arguments" {
     18   run bash error_handling.sh Alice Bob
     19 
     20   [ "$status" -eq 1 ]
     21   [ "$output" = "Usage: ./error_handling <greetee>" ]
     22 }
     23 
     24 @test "print usage banner with no value given" {
     25   run bash error_handling.sh
     26 
     27   [ "$status" -eq 1 ]
     28   [ "$output" = "Usage: ./error_handling <greetee>" ]
     29 }
     30 
     31 @test "empty argument" {
     32   run bash error_handling.sh ""
     33 
     34   [ "$status" -eq 0 ]
     35   [ "$output" = "Hello, " ]
     36 }