Skip to content

Commit

Permalink
ARGH... why do I get caught in the trappings of single quotes?
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/minitest/dev/": change = 8132]
  • Loading branch information
zenspider committed Jan 19, 2013
1 parent 30ad787 commit 753ab88
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions test/minitest/test_minitest_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# encoding: utf-8
require 'minitest/autorun'
require 'stringio'
require "minitest/autorun"
require "stringio"

class MiniSpecA < MiniTest::Spec; end
class MiniSpecB < MiniTest::Spec; end
class ExampleA; end
class ExampleB < ExampleA; end

describe MiniTest::Spec do
# do not parallelize this suite... it just can't handle it.
# do not parallelize this suite... it just can"t handle it.

def assert_triggered expected = "blah", klass = MiniTest::Assertion
@assertion_count += 2
Expand All @@ -18,7 +18,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
end

msg = e.message.sub(/(---Backtrace---).*/m, '\1')
msg.gsub!(/\(oid=[-0-9]+\)/, '(oid=N)')
msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")

assert_equal expected, msg
end
Expand Down Expand Up @@ -77,10 +77,10 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
it "needs to catch an unexpected exception" do
@assertion_count -= 2 # no positive

msg = <<-EOM.gsub(/^ {6}/, '').chomp
msg = <<-EOM.gsub(/^ {6}/, "").chomp
[RuntimeError] exception expected, not
Class: <MiniTest::Assertion>
Message: <\"MiniTest::Assertion\">
Message: <"MiniTest::Assertion">
---Backtrace---
EOM

Expand Down Expand Up @@ -133,7 +133,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion

bad = %w[not raise throw send output be_silent]

expected_wonts = expected_musts.map { |m| m.sub(/^must/, 'wont') }
expected_wonts = expected_musts.map { |m| m.sub(/^must/, "wont") }
expected_wonts.reject! { |m| m =~ /wont_#{Regexp.union(*bad)}/ }

musts.must_equal expected_musts
Expand All @@ -155,7 +155,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
it "needs to verify binary messages" do
42.wont_be(:<, 24).must_equal false

assert_triggered 'Expected 24 to not be < 42.' do
assert_triggered "Expected 24 to not be < 42." do
24.wont_be :<, 42
end

Expand Down Expand Up @@ -191,17 +191,17 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
end

it "needs to verify floats outside a delta" do
skip "float output is different in maglev" if maglev?
# skip "float output is different in maglev" if maglev?

@assertion_count += 1 # extra test

24.wont_be_close_to(42).must_equal false

assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 0.001.' do
assert_triggered "Expected |42 - 42.0| (0.0) to not be < 0.001." do
(6 * 7.0).wont_be_close_to 42
end

assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 1.0e-05.' do
assert_triggered "Expected |42 - 42.0| (0.0) to not be < 1.0e-05." do
(6 * 7.0).wont_be_close_to 42, 0.00001
end

Expand All @@ -211,17 +211,17 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
end

it "needs to verify floats outside an epsilon" do
skip "float output is different in maglev" if maglev?
# skip "float output is different in maglev" if maglev?

@assertion_count += 1 # extra test

24.wont_be_within_epsilon(42).must_equal false

assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 0.042.' do
assert_triggered "Expected |42 - 42.0| (0.0) to not be < 0.042." do
(6 * 7.0).wont_be_within_epsilon 42
end

assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 0.00042.' do
assert_triggered "Expected |42 - 42.0| (0.0) to not be < 0.00042." do
(6 * 7.0).wont_be_within_epsilon 42, 0.00001
end

Expand All @@ -231,17 +231,17 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
end

it "needs to verify floats within a delta" do
skip "float output is different in maglev" if maglev?
# skip "float output is different in maglev" if maglev?

@assertion_count += 1 # extra test

(6.0 * 7).must_be_close_to(42.0).must_equal true

assert_triggered 'Expected |0.0 - 0.01| (0.01) to be < 0.001.' do
assert_triggered "Expected |0.0 - 0.01| (0.01) to be < 0.001." do
(1.0 / 100).must_be_close_to 0.0
end

assert_triggered 'Expected |0.0 - 0.001| (0.001) to be < 1.0e-06.' do
assert_triggered "Expected |0.0 - 0.001| (0.001) to be < 1.0e-06." do
(1.0 / 1000).must_be_close_to 0.0, 0.000001
end

Expand All @@ -255,11 +255,11 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion

(6.0 * 7).must_be_within_epsilon(42.0).must_equal true

assert_triggered 'Expected |0.0 - 0.01| (0.01) to be < 0.0.' do
assert_triggered "Expected |0.0 - 0.01| (0.01) to be < 0.0." do
(1.0 / 100).must_be_within_epsilon 0.0
end

assert_triggered 'Expected |0.0 - 0.001| (0.001) to be < 0.0.' do
assert_triggered "Expected |0.0 - 0.001| (0.001) to be < 0.0." do
(1.0 / 1000).must_be_within_epsilon 0.0, 0.000001
end

Expand Down Expand Up @@ -295,7 +295,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
it "needs to verify instances of a class" do
42.wont_be_instance_of(String).must_equal false

assert_triggered 'Expected 42 to not be an instance of Fixnum.' do
assert_triggered "Expected 42 to not be an instance of Fixnum." do
42.wont_be_instance_of Fixnum
end

Expand All @@ -307,7 +307,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
it "needs to verify kinds of a class" do
42.wont_be_kind_of(String).must_equal false

assert_triggered 'Expected 42 to not be a kind of Integer.' do
assert_triggered "Expected 42 to not be a kind of Integer." do
42.wont_be_kind_of Integer
end

Expand Down Expand Up @@ -360,7 +360,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
it "needs to verify non-emptyness" do
@assertion_count += 3 # empty is 2 assertions

['some item'].wont_be_empty.must_equal false
["some item"].wont_be_empty.must_equal false

assert_triggered "Expected [] to not be empty." do
[].wont_be_empty
Expand Down Expand Up @@ -398,7 +398,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
it "needs to verify objects not responding to a message" do
"".wont_respond_to(:woot!).must_equal false

assert_triggered 'Expected "" to not respond to to_s.' do
assert_triggered "Expected \"\" to not respond to to_s." do
"".wont_respond_to :to_s
end

Expand Down Expand Up @@ -478,7 +478,7 @@ def assert_triggered expected = "blah", klass = MiniTest::Assertion
end

it "needs to verify using any (negative) predicate" do
@assertion_count -= 1 # doesn't take a message
@assertion_count -= 1 # doesn"t take a message

"blah".wont_be(:empty?).must_equal false

Expand Down Expand Up @@ -699,7 +699,7 @@ def test_describe_first_structure
z = describe "second thingy" do end
end

test_methods = ['test_0001_top level it', 'test_0002_не латинские буквы-и-спецсимволы&いった α, β, γ, δ, ε hello!!! world'].sort
test_methods = ["test_0001_top level it", "test_0002_не латинские буквы-и-спецсимволы&いった α, β, γ, δ, ε hello!!! world"].sort

assert_equal test_methods, [x1, x2]
assert_equal test_methods,
Expand Down Expand Up @@ -742,7 +742,7 @@ class TestSpecInTestCase < MetaMetaMetaTestCase
def setup
super

@tc = MiniTest::Unit::TestCase.new 'fake tc'
@tc = MiniTest::Unit::TestCase.new "fake tc"
@assertion_count = 1
end

Expand All @@ -751,8 +751,8 @@ def util_assert_triggered expected, klass = MiniTest::Assertion # REFACTOR
yield
end

msg = e.message.sub(/(---Backtrace---).*/m, '\1')
msg.gsub!(/\(oid=[-0-9]+\)/, '(oid=N)')
msg = e.message.sub(/(---Backtrace---).*/m, "\1")
msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")

assert_equal expected, msg
end
Expand All @@ -776,7 +776,7 @@ def test_expectation_triggered

def test_expectation_with_a_message
util_assert_triggered "Expected: 2\n Actual: 1" do
1.must_equal 2, ''
1.must_equal 2, ""
end
end
end

0 comments on commit 753ab88

Please sign in to comment.