class TestData
Public Instance Methods
_run_test(test_case) { |test| ... }
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 340 def _run_test(test_case) result = Test::Unit::TestResult.new test = test_case.suite yield(test) if block_given? test.run(result) {} result end
setup()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 138 def setup TestCalc.testing = true end
teardown()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 142 def teardown TestCalc.testing = false end
test_data(data)
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 215 def test_data(data) test_plus = data[:test_case].new("test_plus") data_sets = Test::Unit::DataSets.new data[:data_sets].each do |data_set| data_sets.add(data_set) end assert_equal(data_sets, test_plus[:data]) end
test_data_no_arguments_without_block()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 146 def test_data_no_arguments_without_block assert_raise(ArgumentError) do self.class.data end end
test_data_patterns()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 224 def test_data_patterns test = TestCalc::TestPatterns.new("test_use_data") data_sets = Test::Unit::DataSets.new data_sets << [:x, [-1, 1, 0]] data_sets << [:y, [-100, 100]] data_sets << [:z, ["a", "b", "c"]] assert_equal(data_sets, test[:data]) end
test_data_patterns_keep()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 233 def test_data_patterns_keep test = TestCalc::TestPatternsKeep.new("test_use_data_keep") data_sets = Test::Unit::DataSets.new data_sets.add([:x, [-1, 1, 0]], {keep: true}) data_sets.add([:z, ["a", "b", "c"]], {keep: true}) assert_equal(data_sets, test[:data]) end
test_equal(test_case)
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 320 def test_equal(test_case) suite = test_case.suite positive_positive_test = suite.tests.find do |test| test.data_label == "positive positive" end suite.tests.delete(positive_positive_test) assert_equal(["test_plus[positive negative](#{test_case.name})"], suite.tests.collect {|test| test.name}.sort) end
test_normalize_value(data)
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 335 def test_normalize_value(data) loader = Test::Unit::Data::ClassMethods::Loader.new(self) assert_equal(data[:expected], loader.__send__(:normalize_value, data[:target])) end
test_run(test_case)
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 304 def test_run(test_case) result = _run_test(test_case) assert_equal("2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, " \ "0 omissions, 0 notifications", result.to_s) end
test_run_normal_test_in_subclass()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 310 def test_run_normal_test_in_subclass result = _run_test(TestCalc::TestSuperclass::TestNormalTestInSubclass) assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, " \ "0 omissions, 0 notifications", result.to_s) end
test_suite(test_case)
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 245 def test_suite(test_case) suite = test_case.suite assert_equal(["test_plus[positive negative](#{test_case.name})", "test_plus[positive positive](#{test_case.name})"], suite.tests.collect {|test| test.name}.sort) end
test_suite_patterns()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 252 def test_suite_patterns test_case = TestCalc::TestPatterns suite = test_case.suite assert_equal([ "test_use_data[x: -1, y: -100, z: \"a\"](#{test_case.name})", "test_use_data[x: -1, y: -100, z: \"b\"](#{test_case.name})", "test_use_data[x: -1, y: -100, z: \"c\"](#{test_case.name})", "test_use_data[x: -1, y: 100, z: \"a\"](#{test_case.name})", "test_use_data[x: -1, y: 100, z: \"b\"](#{test_case.name})", "test_use_data[x: -1, y: 100, z: \"c\"](#{test_case.name})", "test_use_data[x: 0, y: -100, z: \"a\"](#{test_case.name})", "test_use_data[x: 0, y: -100, z: \"b\"](#{test_case.name})", "test_use_data[x: 0, y: -100, z: \"c\"](#{test_case.name})", "test_use_data[x: 0, y: 100, z: \"a\"](#{test_case.name})", "test_use_data[x: 0, y: 100, z: \"b\"](#{test_case.name})", "test_use_data[x: 0, y: 100, z: \"c\"](#{test_case.name})", "test_use_data[x: 1, y: -100, z: \"a\"](#{test_case.name})", "test_use_data[x: 1, y: -100, z: \"b\"](#{test_case.name})", "test_use_data[x: 1, y: -100, z: \"c\"](#{test_case.name})", "test_use_data[x: 1, y: 100, z: \"a\"](#{test_case.name})", "test_use_data[x: 1, y: 100, z: \"b\"](#{test_case.name})", "test_use_data[x: 1, y: 100, z: \"c\"](#{test_case.name})", ], suite.tests.collect {|test| test.name}.sort) end
test_suite_patterns_group()
click to toggle source
# File test-unit-3.3.4/test/test-data.rb, line 278 def test_suite_patterns_group test_case = TestCalc::TestPatternsGroup suite = test_case.suite assert_equal([ "test_use_data[group: 1, a: -1, b: :a](#{test_case.name})", "test_use_data[group: 1, a: -1, b: :b](#{test_case.name})", "test_use_data[group: 1, a: 0, b: :a](#{test_case.name})", "test_use_data[group: 1, a: 0, b: :b](#{test_case.name})", "test_use_data[group: 1, a: 1, b: :a](#{test_case.name})", "test_use_data[group: 1, a: 1, b: :b](#{test_case.name})", "test_use_data[group: :z, x: 2, y: \"a\"](#{test_case.name})", "test_use_data[group: :z, x: 2, y: \"b\"](#{test_case.name})", "test_use_data[group: :z, x: 2, y: \"c\"](#{test_case.name})", "test_use_data[group: :z, x: 9, y: \"a\"](#{test_case.name})", "test_use_data[group: :z, x: 9, y: \"b\"](#{test_case.name})", "test_use_data[group: :z, x: 9, y: \"c\"](#{test_case.name})", ], suite.tests.collect {|test| test.name}.sort) end