Sha256: 81f3f9bec24880983774483f3e78505fe336628017d79f097fb957392388487a
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
# Copyright (c) 2010 The Mirah project authors. All Rights Reserved. # All contributing project authors may be found in the NOTICE file. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'bundler/setup' require 'test/unit' require 'mirah' require 'jruby' require 'stringio' require 'fileutils' test_tmp_dir = File.expand_path(File.dirname(__FILE__)+'/../tmp_test/') TEST_DEST = "#{test_tmp_dir}/test_classes/" FIXTURE_TEST_DEST = "#{test_tmp_dir}/fixtures/" module CommonAssertions import java.lang.System import java.io.PrintStream def assert_include(value, array, message=nil) message = build_message message, '<?> does not include <?>', array, value assert_block message do array.include? value end end def capture_output saved_output = System.out saved_stdout = $stdout saved_stderr = $stderr output = StringIO.new System.setOut(PrintStream.new(output.to_outputstream)) $stdout = output $stderr = output begin yield output.rewind output.read ensure System.setOut(saved_output) $stdout = saved_stdout $stderr = saved_stderr end end def assert_output(expected, &block) assert_equal(expected, capture_output(&block)) end end class Test::Unit::TestCase include CommonAssertions end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.1.2-java | test/test_helper.rb |