Welcome to mirror list, hosted at ThFree Co, Russian Federation.

assert_not_equal.bats « test - github.com/bats-core/bats-assert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28f0142dd73d57f872564f5092e2cdc6fd3c6f86 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bats

load test_helper

@test 'assert_not_equal() <actual> <unexpected>: returns 0 if <actual> does not equal <unexpected>' {
  run assert_not_equal foo bar
  assert_test_pass

  run assert_not_equal "foo" "bar"
  assert_test_pass

  run assert_not_equal "foo" ""
  assert_test_pass

  run assert_not_equal "" "foo"
}

@test 'assert_not_equal() <actual> <unexpected>: returns 1 and displays details if <actual> equals <unexpected>' {
  run assert_not_equal 'foobar' 'foobar'
  assert_test_fail <<'ERR_MSG'

-- values should not be equal --
unexpected : foobar
actual     : foobar
--
ERR_MSG

  run assert_not_equal 1 1
  assert_test_fail <<'ERR_MSG'

-- values should not be equal --
unexpected : 1
actual     : 1
--
ERR_MSG
}

@test 'assert_not_equal() <actual> <unexpected>: displays details in multi-line format if <actual> and <unexpected> are longer than one line' {
  run assert_not_equal $'foo\nbar' $'foo\nbar'
  assert_test_fail <<'ERR_MSG'

-- values should not be equal --
unexpected (2 lines):
  foo
  bar
actual (2 lines):
  foo
  bar
--
ERR_MSG
}

@test 'assert_not_equal() <actual> <unexpected>: performs literal matching' {
    run assert_not_equal 'a' '*'
    assert_test_pass
}