Sha256: 10c555d14808db31801b88cbe1fa36647deae39c3226255d0c63e29a69ceee68
Contents?: true
Size: 1.1 KB
Versions: 10
Compression:
Stored size: 1.1 KB
Contents
#!/usr/bin/env ruby # $Id$ require 'test/unit' require 'fileutils' require 'tempfile' SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__ # Test TestLineNumbers module class TestLineNumbers1 < Test::Unit::TestCase @@TEST_DIR = File.expand_path(File.dirname(__FILE__)) @@TOP_SRC_DIR = File.join(@@TEST_DIR, '..', 'lib') require File.join(@@TOP_SRC_DIR, 'tracelines19.rb') @@rcov_file = File.join(@@TEST_DIR, 'rcov-bug.rb') File.open(@@rcov_file, 'r') {|fp| first_line = fp.readline[1..-2] @@rcov_lnums = eval(first_line, binding, __FILE__, __LINE__) } def test_for_file rcov_lines = TraceLineNumbers.lnums_for_file(@@rcov_file) assert_equal(@@rcov_lnums, rcov_lines) end def test_for_string string = "# Some rcov bugs.\nz = \"\nNow is the time\n\"\n\nz =~ \n /\n 5\n /ix\n" rcov_lines = TraceLineNumbers.lnums_for_str(string) assert_equal([2, 9], rcov_lines) end def test_for_string_array load(@@rcov_file, 0) rcov_lines = TraceLineNumbers.lnums_for_str_array(SCRIPT_LINES__[@@rcov_file]) assert_equal(@@rcov_lnums, rcov_lines) end end
Version data entries
10 entries across 9 versions & 4 rubygems