class TestCodeSnippet::TestDefaultExternal
Public Instance Methods
setup()
click to toggle source
# File test-unit-3.3.4/test/test-code-snippet.rb, line 51 def setup suppress_warning do @default_external = Encoding.default_external end @fetcher = Test::Unit::CodeSnippetFetcher.new end
suppress_warning() { || ... }
click to toggle source
# File test-unit-3.3.4/test/test-code-snippet.rb, line 41 def suppress_warning verbose = $VERBOSE begin $VERBOSE = false yield ensure $VERBOSE = verbose end end
teardown()
click to toggle source
# File test-unit-3.3.4/test/test-code-snippet.rb, line 58 def teardown suppress_warning do Encoding.default_external = @default_external end end
test_windows_31j()
click to toggle source
# File test-unit-3.3.4/test/test-code-snippet.rb, line 64 def test_windows_31j source = Tempfile.new(["test-code-snippet", ".rb"]) source.puts(<<-SOURCE) puts("あいうえお") SOURCE source.flush suppress_warning do Encoding.default_external = "Windows-31J" end assert_equal([ [1, "puts(\"あいうえお\")", {:target_line? => false}], ], @fetcher.fetch(source.path, 0)) end