Method: Funit::TestSuite#expand

Defined in:
lib/funit/test_suite.rb

#expandObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/funit/test_suite.rb', line 63

def expand
 
  funit_file = @suiteName+".fun"
  $stderr.print "expanding #{funit_file}..."
   
  funit_contents = IO.readlines(funit_file)
  @funit_TotalLines = funit_contents.length

  while (line = funit_contents.shift) && line !~ $keyword
    puts line
  end

  funit_contents.unshift line

  puts " contains\n\n"

  while (line = funit_contents.shift)
    case line
    when $commentLine
      puts line
    when /beginSetup/i
      addtoSetup funit_contents
    when /beginTeardown/i
      addtoTeardown funit_contents
    when /XbeginTest\s+(\w+)/i
      ignoreTest($1,funit_contents)
    when /beginTest\s+(\w+)/i
      aTest($1,funit_contents)
    when /beginTest/i
      syntaxError "no name given for beginTest", @suiteName
    when /end(Setup|Teardown|Test)/i
      syntaxError "no matching begin#$1 for an #$&", @suiteName
    when $assertRegEx
      syntaxError "#$1 assert not in a test block", @suiteName
    else
      puts line
    end
  end # while

  $stderr.puts "done."

end