Skip to content

Commit ecd5adb

Browse files
committed
✅ Add TruffleRuby/JRuby pend/omit test helpers
1 parent 86e32ae commit ecd5adb

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
@@ -73,6 +73,46 @@ def assert_pattern
7373
end
7474
end
7575

76+
def pend_if(condition, *args, &block)
77+
if condition
78+
pend(*args, &block)
79+
else
80+
block.call if block
81+
end
82+
end
83+
84+
def pend_unless(condition, *args, &block)
85+
if condition
86+
block.call if block
87+
else
88+
pend(*args, &block)
89+
end
90+
end
91+
92+
def omit_unless_cruby(msg = "test omitted for non-CRuby", &block)
93+
omit_unless(RUBY_ENGINE == "ruby", msg, &block)
94+
end
95+
96+
def omit_if_truffleruby(msg = "test omitted on TruffleRuby", &block)
97+
omit_if(RUBY_ENGINE == "truffleruby", msg, &block)
98+
end
99+
100+
def omit_if_jruby(msg = "test omitted on JRuby", &block)
101+
omit_if(RUBY_ENGINE == "jruby", msg, &block)
102+
end
103+
104+
def pend_unless_cruby(msg = "test is pending for non-CRuby", &block)
105+
pend_unless(RUBY_ENGINE == "ruby", msg, &block)
106+
end
107+
108+
def pend_if_truffleruby(msg = "test is pending on TruffleRuby", &block)
109+
pend_if(RUBY_ENGINE == "truffleruby", msg, &block)
110+
end
111+
112+
def pend_if_jruby(msg = "test is pending on JRuby", &block)
113+
pend_if(RUBY_ENGINE == "jruby", msg, &block)
114+
end
115+
76116
end
77117

78118
require_relative "profiling_helper"

0 commit comments

Comments
 (0)