Module: XMP2Assert::Assertions
- Includes:
- Test::Unit::Assertions, XMP2Rexp
- Defined in:
- lib/xmp2assert/assertions.rb
Overview
Helper module that implements assertions.
Instance Method Summary collapse
-
#assert_capture2e(expected, script, message = nil, rubyopts: nil, **opts) ⇒ Object
Run a ruby script and assert for its output.
-
#assert_xmp(xmp, expr, message = nil) ⇒ Object
Assert if the given expression is in the same form of xmp.
Methods included from XMP2Rexp
Instance Method Details
#assert_capture2e(expected, script, message = nil, rubyopts: nil, **opts) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/xmp2assert/assertions.rb', line 56 def assert_capture2e expected, script, = nil, rubyopts: nil, **opts qscript = XMP2Assert::Quasifile.new script actual, _ = ruby qscript, rubyopts: rubyopts, **opts actual.force_encoding expected.encoding return assert_xmp_raw expected, actual, end |
#assert_xmp(xmp, expr, message = nil) ⇒ Object
Assert if the given expression is in the same form of xmp.
assert_xmp '#<Object:0x007f896c9b49c8>', Object.new
72 73 74 |
# File 'lib/xmp2assert/assertions.rb', line 72 def assert_xmp xmp, expr, = nil assert_xmp_raw xmp, expr.inspect, end |