File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -102,3 +102,32 @@ Feature: Method Overloading
102
102
"""
103
103
sound: woof
104
104
"""
105
+
106
+ Scenario : Incorrect Positional Args Method
107
+ Given a file named "incorrect_positional_args_method.rb" with:
108
+ """ruby
109
+ require "contracts"
110
+ C = Contracts
111
+
112
+ class Example
113
+ include Contracts::Core
114
+
115
+ # Notice that this method's contract is wider than the one below
116
+ # This would cause this method to be called every time but never the one below
117
+ Contract C::Num => C::Num
118
+ def fact(x)
119
+ x * fact(x - 1)
120
+ end
121
+
122
+ Contract 1 => 1
123
+ def fact(x)
124
+ x
125
+ end
126
+ end
127
+ puts Example.new.fact(4)
128
+ """
129
+ When I run `ruby incorrect_positional_args_method.rb`
130
+ Then the output should contain:
131
+ """
132
+ stack level too deep (SystemStackError)
133
+ """
You can’t perform that action at this time.
0 commit comments