Class: XMP2Assert::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/xmp2assert/converter.rb

Overview

This class converts a Ruby script into assertions

Class Method Summary collapse

Class Method Details

.convert(obj, file = nil, line = nil) ⇒ (Quasifile,String,String,String)

Detects XMP and make them assertions. For example:

def foo; 2; end
1 + foo # => 3

would become

def foo; 2; end
(1 + foo).tap {|i| assert_xmp("3", i ) }

Returns:

  • ((Quasifile,String,String,String))

    a tuple of comment-converted source, its expected stdout, expected stderr, and expected exception.



51
52
53
54
# File 'lib/xmp2assert/converter.rb', line 51

def self.convert obj, file = nil, line = nil
  this = new obj, file, line
  return this.send :convert
end