Skip to content

Commit ddc5081

Browse files
committed
✅ Add TruffleRuby/JRuby pend/omit test helpers
1 parent ccbc7f2 commit ddc5081

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/lib/helper.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,44 @@ def assert_pattern
5757
end
5858
end
5959

60+
def pend_if(condition, *args, &block)
61+
if condition
62+
pend(*args, &block)
63+
else
64+
block.call if block
65+
end
66+
end
67+
68+
def pend_unless(condition, *args, &block)
69+
if condition
70+
block.call if block
71+
else
72+
pend(*args, &block)
73+
end
74+
end
75+
76+
def omit_unless_cruby(msg = "test omitted for non-CRuby", &block)
77+
omit_unless(RUBY_ENGINE == "ruby", msg, &block)
78+
end
79+
80+
def omit_if_truffleruby(msg = "test omitted on TruffleRuby", &block)
81+
omit_if(RUBY_ENGINE == "truffleruby", msg, &block)
82+
end
83+
84+
def omit_if_jruby(msg = "test omitted on JRuby", &block)
85+
omit_if(RUBY_ENGINE == "jruby", msg, &block)
86+
end
87+
88+
def pend_unless_cruby(msg = "test is pending for non-CRuby", &block)
89+
pend_unless(RUBY_ENGINE == "ruby", msg, &block)
90+
end
91+
92+
def pend_if_truffleruby(msg = "test is pending on TruffleRuby", &block)
93+
pend_if(RUBY_ENGINE == "truffleruby", msg, &block)
94+
end
95+
96+
def pend_if_jruby(msg = "test is pending on JRuby", &block)
97+
pend_if(RUBY_ENGINE == "jruby", msg, &block)
98+
end
99+
60100
end

0 commit comments

Comments
 (0)