A container for MSpec global data
Zachary Kurmas
Copyright © 2012
Append group
to the list of test groups.
(The define
method in the global namespace uses this method to
store the test groups it creates.)
# File lib/mipsunit/mspec/global.rb, line 21 def add_group(group) @test_groups << group end
get test groups
# File lib/mipsunit/mspec/global.rb, line 27 def groups @test_groups end
print a warning just one time per process
# File lib/mipsunit/mspec/global.rb, line 32 def print_single_warning(warning) if (warning == :data_in_before) unless @data_in_before message = "WARNING! Calling #data in a 'before' block will generate a separate label for each test. " message += "If the code under test should not modify the data in memory," message += " call .data outside the 'before' block. " message += "If the code under test should modify the data, then use #data! to suppress this warning." $stderr.puts(message) @data_in_before = true end else raise IllegalArgumentException.new("Parameter #{warning} unrecognized") end end
# File lib/mipsunit/mspec/global.rb, line 12 def initialize @test_groups = [] @data_in_before = nil end