From 3c1be5322fbf775ac4e807e510f7bc50fcd5e305 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 9 Jan 2010 11:38:16 -0800 Subject: converting to minitest --- test/psych/test_emitter.rb | 20 ++++++++++++++++++++ test/psych/test_parser.rb | 1 + test/psych/test_struct.rb | 5 +++-- test/yaml/test_array.rb | 2 +- test/yaml/test_boolean.rb | 2 +- test/yaml/test_class.rb | 2 +- test/yaml/test_emitter.rb | 20 -------------------- test/yaml/test_exception.rb | 2 +- test/yaml/test_hash.rb | 2 +- test/yaml/test_null.rb | 2 +- test/yaml/test_omap.rb | 2 +- test/yaml/test_set.rb | 2 +- test/yaml/test_string.rb | 2 +- test/yaml/test_symbol.rb | 2 +- 14 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 test/psych/test_emitter.rb delete mode 100644 test/yaml/test_emitter.rb (limited to 'test') diff --git a/test/psych/test_emitter.rb b/test/psych/test_emitter.rb new file mode 100644 index 0000000..d617353 --- /dev/null +++ b/test/psych/test_emitter.rb @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +require 'minitest/autorun' +require 'psych' +require 'stringio' + +module Psych + class TestEmitter < MiniTest::Unit::TestCase + def test_emit_utf_8 + out = StringIO.new + emitter = Psych::Emitter.new out + emitter.start_stream Psych::Nodes::Stream::UTF8 + emitter.start_document [], [], false + emitter.scalar '日本語', nil, nil, false, true, 1 + emitter.end_document true + emitter.end_stream + assert_match('日本語', out.string) + end + end +end diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb index d6d81ef..197dde7 100644 --- a/test/psych/test_parser.rb +++ b/test/psych/test_parser.rb @@ -21,6 +21,7 @@ module Psych end def setup + super warn "#{name}" if ENV['TESTOPTS'] == '-v' @parser = Psych::Parser.new EventCatcher.new end diff --git a/test/psych/test_struct.rb b/test/psych/test_struct.rb index 1fb8149..3d3b9bc 100644 --- a/test/psych/test_struct.rb +++ b/test/psych/test_struct.rb @@ -1,7 +1,8 @@ -require 'helper' +require 'minitest/autorun' +require 'psych' module Psych - class TestStruct < Test::Unit::TestCase + class TestStruct < MiniTest::Unit::TestCase class StructSubclass < Struct.new(:foo) def initialize foo, bar super(foo) diff --git a/test/yaml/test_array.rb b/test/yaml/test_array.rb index 7e7318e..23434e5 100644 --- a/test/yaml/test_array.rb +++ b/test/yaml/test_array.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestArray < Test::Unit::TestCase + class TestArray < MiniTest::Unit::TestCase def setup @list = [{ :a => 'b' }, 'foo'] end diff --git a/test/yaml/test_boolean.rb b/test/yaml/test_boolean.rb index 8113348..5edeb87 100644 --- a/test/yaml/test_boolean.rb +++ b/test/yaml/test_boolean.rb @@ -4,7 +4,7 @@ module YAML ### # Test booleans from YAML spec: # http://yaml.org/type/bool.html - class TestBoolean < Test::Unit::TestCase + class TestBoolean < MiniTest::Unit::TestCase %w{ yes Yes YES true True TRUE on On ON }.each do |truth| define_method(:"test_#{truth}") do assert_equal true, YAML.load("--- #{truth}") diff --git a/test/yaml/test_class.rb b/test/yaml/test_class.rb index effa852..7ad54a6 100644 --- a/test/yaml/test_class.rb +++ b/test/yaml/test_class.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestClass < Test::Unit::TestCase + class TestClass < MiniTest::Unit::TestCase def test_to_yaml assert_raises(::TypeError) do TestClass.to_yaml diff --git a/test/yaml/test_emitter.rb b/test/yaml/test_emitter.rb deleted file mode 100644 index d617353..0000000 --- a/test/yaml/test_emitter.rb +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -require 'minitest/autorun' -require 'psych' -require 'stringio' - -module Psych - class TestEmitter < MiniTest::Unit::TestCase - def test_emit_utf_8 - out = StringIO.new - emitter = Psych::Emitter.new out - emitter.start_stream Psych::Nodes::Stream::UTF8 - emitter.start_document [], [], false - emitter.scalar '日本語', nil, nil, false, true, 1 - emitter.end_document true - emitter.end_stream - assert_match('日本語', out.string) - end - end -end diff --git a/test/yaml/test_exception.rb b/test/yaml/test_exception.rb index f646008..da0e6b0 100644 --- a/test/yaml/test_exception.rb +++ b/test/yaml/test_exception.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestException < Test::Unit::TestCase + class TestException < MiniTest::Unit::TestCase class Wups < Exception attr_reader :foo, :bar def initialize *args diff --git a/test/yaml/test_hash.rb b/test/yaml/test_hash.rb index 16a9ee3..e585bbc 100644 --- a/test/yaml/test_hash.rb +++ b/test/yaml/test_hash.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestHash < Test::Unit::TestCase + class TestHash < MiniTest::Unit::TestCase def setup @hash = { :a => 'b' } end diff --git a/test/yaml/test_null.rb b/test/yaml/test_null.rb index 24c8ab1..e7d08df 100644 --- a/test/yaml/test_null.rb +++ b/test/yaml/test_null.rb @@ -4,7 +4,7 @@ module YAML ### # Test null from YAML spec: # http://yaml.org/type/null.html - class TestNull < Test::Unit::TestCase + class TestNull < MiniTest::Unit::TestCase def test_null_list assert_equal [nil] * 5, YAML.load(<<-eoyml) --- diff --git a/test/yaml/test_omap.rb b/test/yaml/test_omap.rb index 8186f69..836c822 100644 --- a/test/yaml/test_omap.rb +++ b/test/yaml/test_omap.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestOmap < Test::Unit::TestCase + class TestOmap < MiniTest::Unit::TestCase def test_self_referential map = YAML::Omap.new map['foo'] = 'bar' diff --git a/test/yaml/test_set.rb b/test/yaml/test_set.rb index e62b6cd..5468d26 100644 --- a/test/yaml/test_set.rb +++ b/test/yaml/test_set.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestSet < Test::Unit::TestCase + class TestSet < MiniTest::Unit::TestCase def setup @set = YAML::Set.new @set['foo'] = 'bar' diff --git a/test/yaml/test_string.rb b/test/yaml/test_string.rb index 637d65b..0faf8d8 100644 --- a/test/yaml/test_string.rb +++ b/test/yaml/test_string.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestString < Test::Unit::TestCase + class TestString < MiniTest::Unit::TestCase def test_binary_string_null string = "\x00" yml = YAML.dump string diff --git a/test/yaml/test_symbol.rb b/test/yaml/test_symbol.rb index c4f77c4..57e1385 100644 --- a/test/yaml/test_symbol.rb +++ b/test/yaml/test_symbol.rb @@ -1,7 +1,7 @@ require 'helper' module YAML - class TestSymbol < Test::Unit::TestCase + class TestSymbol < MiniTest::Unit::TestCase def test_to_yaml assert_equal :a, YAML.load(:a.to_yaml) end -- cgit v1.2.3