Module: Tap::Test::Assertions

Included in:
FileTest
Defined in:
lib/tap/test/assertions.rb

Instance Method Summary collapse

Instance Method Details

#assert_alike(a, b, msg = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tap/test/assertions.rb', line 22

def assert_alike(a, b, msg=nil)
  if b =~ a
    assert true
  else
    flunk %Q{
#{msg}
================= expected output like ==================
#{Utils.whitespace_escape(a)}
======================== but was ========================
#{Utils.whitespace_escape(b)}
=========================================================
}
  end
end

#assert_output_equal(a, b, msg = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tap/test/assertions.rb', line 6

def assert_output_equal(a, b, msg=nil)
  a = a[1..-1] if a[0] == ?\n
  if a == b
    assert true
  else
    flunk %Q{
#{msg}
==================== expected output ====================
#{Utils.whitespace_escape(a)}
======================== but was ========================
#{Utils.whitespace_escape(b)}
=========================================================
}
  end
end