Skip to content

Commit b91238f

Browse files
committed
3.4 doesn't work yet
1 parent b2e1933 commit b91238f

3 files changed

Lines changed: 35 additions & 9 deletions

File tree

test/safe/explain_test.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# typed: strict
22

33
require "test_helper"
4+
require "support/version_helper"
45

56
class ExplainTest < Minitest::Test
67
include Mocktail::DSL
78
extend T::Sig
9+
include VersionHelper
810

911
class Thing
1012
extend T::Sig
@@ -41,7 +43,7 @@ def test_explain_stub_returned_nil
4143
4244
The call site:
4345
44-
#{__FILE__}:25:in `test_explain_stub_returned_nil'
46+
#{__FILE__}:27:in #{at_least_ruby_3_4? ? "'ExplainTest#" : "`"}test_explain_stub_returned_nil'
4547
4648
No stubbings were configured on this method.
4749
@@ -75,7 +77,7 @@ def test_explain_stub_returned_nil_with_stubbings
7577
7678
The call site:
7779
78-
#{__FILE__}:56:in `test_explain_stub_returned_nil_with_stubbings'
80+
#{__FILE__}:58:in #{at_least_ruby_3_4? ? "'ExplainTest#" : "`"}test_explain_stub_returned_nil_with_stubbings'
7981
8082
Stubbings configured prior to this call but not satisfied by it:
8183

test/support/version_helper.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# typed: false
2+
3+
module VersionHelper
4+
def ruby_version
5+
Gem::Version.new(RUBY_VERSION)
6+
end
7+
8+
def at_least_ruby_3_4?
9+
ruby_version >= "3.4"
10+
end
11+
end

test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# typed: strict
22

33
require "test_helper"
4+
require "support/version_helper"
45

56
module Mocktail
67
class StringifiesCallTest < Minitest::Test
78
extend T::Sig
9+
include VersionHelper
810

911
sig { params(name: String).void }
1012
def initialize(name)
@@ -33,21 +35,32 @@ def test_some_calls
3335
assert_equal "hi([], [1], [[2]], [[3, 4], [5, 6]])", invoke(args: [
3436
[], [1], [[2]], [[3, 4], [5, 6]]
3537
])
36-
assert_equal "hi({}, {:a=>1}, {:b=>2, :c=>3}, {:d=>[4, {:e=>5}]})", invoke(args: [
37-
{}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]}
38-
])
38+
39+
if at_least_ruby_3_4?
40+
assert_equal "hi({}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]})", invoke(args: [
41+
{}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]}
42+
])
43+
else
44+
assert_equal "hi({}, {:a=>1}, {:b=>2, :c=>3}, {:d=>[4, {:e=>5}]})", invoke(args: [
45+
{}, {a: 1}, {b: 2, c: 3}, {d: [4, {e: 5}]}
46+
])
47+
end
3948

4049
# Kwargs
4150
assert_equal "hi(a: 1)", invoke(kwargs: {a: 1})
4251
assert_equal "hi(c: 2, b: 3)", invoke(kwargs: {c: 2, b: 3})
43-
assert_equal "hi(d: {:e=>4}, f: [:g, {:h=>5}])", invoke(kwargs: {d: {e: 4}, f: [:g, {h: 5}]})
52+
if at_least_ruby_3_4?
53+
assert_equal "hi(d: {e: 4}, f: [:g, {h: 5}])", invoke(kwargs: {d: {e: 4}, f: [:g, {h: 5}]})
54+
else
55+
assert_equal "hi(d: {:e=>4}, f: [:g, {:h=>5}])", invoke(kwargs: {d: {e: 4}, f: [:g, {h: 5}]})
56+
end
4457

4558
# Blocks & Procs
46-
assert_equal "hi { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:46 }", invoke {}
47-
assert_equal "hi(&lambda[test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:47])", invoke(&lambda {})
59+
assert_equal "hi { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:59 }", invoke {}
60+
assert_equal "hi(&lambda[test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:60])", invoke(&lambda {})
4861

4962
# Mix & Match
50-
assert_equal "hi(:a, 1, b: 2) { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:50 }", invoke(args: [:a, 1], kwargs: {b: 2}) { |c| 3 }
63+
assert_equal "hi(:a, 1, b: 2) { Proc at test/unit/verifies_call/raises_verification_error/stringifies_call_test.rb:63 }", invoke(args: [:a, 1], kwargs: {b: 2}) { |c| 3 }
5164
end
5265

5366
private

0 commit comments

Comments
 (0)