Class: TestML

Inherits:
Object
  • Object
show all
Defined in:
lib/testml.rb,
lib/testml/setup.rb,
lib/testml/runtime.rb

Defined Under Namespace

Modules: Constant, Util Classes: Assertion, Assignment, Block, Bool, Bridge, Call, Callable, Compiler, Error, Expression, Function, Library, List, Native, None, Num, Object, Point, Runtime, Setup, Statement, Str, TestCase

Constant Summary collapse

VERSION =
'0.0.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) {|_self| ... } ⇒ TestML

Returns a new instance of TestML.

Yields:

  • (_self)

Yield Parameters:

  • _self (TestML)

    the object that the method was called on



10
11
12
13
# File 'lib/testml.rb', line 10

def initialize attributes={}
  attributes.each { |k,v| self.send "#{k}=", v }
  yield self if block_given?
end

Instance Attribute Details

#bridgeObject

Returns the value of attribute bridge.



6
7
8
# File 'lib/testml.rb', line 6

def bridge
  @bridge
end

#compilerObject

Returns the value of attribute compiler.



5
6
7
# File 'lib/testml.rb', line 5

def compiler
  @compiler
end

#libraryObject

Returns the value of attribute library.



7
8
9
# File 'lib/testml.rb', line 7

def library
  @library
end

#runtimeObject

Returns the value of attribute runtime.



4
5
6
# File 'lib/testml.rb', line 4

def runtime
  @runtime
end

#testmlObject

Returns the value of attribute testml.



8
9
10
# File 'lib/testml.rb', line 8

def testml
  @testml
end

Instance Method Details

#run(*args) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/testml.rb', line 15

def run(*args)
  set_default_classes
  @runtime.new(
    compiler: @compiler,
    bridge: @bridge,
    library: @library,
    testml: @testml,
  ).run(*args)
end

#set_default_classesObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/testml.rb', line 25

def set_default_classes
  if not @runtime
    require 'testml/runtime/unit'
    @runtime = TestML::Runtime::Unit
  end
  if not @compiler
    require 'testml/compiler/pegex'
    @compiler = TestML::Compiler::Pegex
  end
  if not @bridge
    require 'testml/bridge'
    @bridge = TestML::Bridge
  end
  if not @library
    require 'testml/library/standard'
    require 'testml/library/debug'
    @library = [
      TestML::Library::Standard,
      TestML::Library::Debug,
    ]
  end
end