test/test_examples.rb in ruby-graphviz-0.9.19 vs test/test_examples.rb in ruby-graphviz-0.9.20
- old
+ new
@@ -1,6 +1,6 @@
-require File.join(File.dirname(__FILE__),'support.rb')
+require File.expand_path('support.rb', File.dirname(__FILE__))
class GraphVizTest < Test::Unit::TestCase
#
# you can run a subset of all the samples like this:
@@ -101,11 +101,11 @@
def assert_output_pattern tgt_regexp, number
path = self.class.number_to_path[number]
setup_sample path
out, err = fake_popen2(path)
assert_equal "", err, "no errors"
- assert_match tgt_regexp, out, "output for sample#{number} should match regexp"
+ assert_match tgt_regexp, out.gsub(/\r\n/, "\n"), "output for sample#{number} should match regexp"
end
def assert_sample_file_has_no_output path
setup_sample(path)
begin
@@ -129,10 +129,10 @@
end
def hack_output_path path
# hack $0 to change where the output image is written to
fake_example_path = File.join(OutputDir, File.basename(path))
- $0 = fake_example_path.dup
- fail("hack failed") if ($0 != fake_example_path)
+ $program_name = fake_example_path.dup
+ alias $0 $program_name
self.class.last_image_path = "#{$0}.png"
end
end