summaryrefslogtreecommitdiff
path: root/test/example.bats
blob: c6716379744600bf2e86217fd8046aa3cc6fe547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bats

load test_helper

@test "testing" {
  result="$(echo 2+2 | bc)"
  [ "$result" -eq 4 ]
}

@test "is successfull" {
  run echo 'hello'

  assert_success $'hello'
}

@test "produces an error" {
  run rm blah

  if [[ "$OSTYPE" == "darwin"* ]]; then
    assert_failure $'rm: blah: No such file or directory'
  elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
    assert_failure $'rm: cannot remove \'blah\': No such file or directory'
  elif [[ "$OSTYPE" == "linux-musl"* ]]; then
    assert_failure $'rm: can\'t remove \'blah\': No such file or directory'
  else
    assert_failure
  fi
}