Skip to content

Commit e729870

Browse files
committed
🚧 [DO NOT MERGE] Un-pend Data tests for JRuby/TruffleRuby
This should _not_ be merged into main. 😉 It's only temporary, to track bugs in TruffleRuby and JRuby until they are addressed.
1 parent 26d9fdc commit e729870

File tree

3 files changed

+51
-54
lines changed

3 files changed

+51
-54
lines changed

test/net/imap/test_connection_state.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,23 @@ class ConnectionStateTest < Net::IMAP::TestCase
2525
end
2626

2727
test "#deconstruct" do
28-
pend_if_truffleruby "TruffleRuby bug overriding ::Data methods" do
29-
assert_equal [:not_authenticated], NotAuthenticated[].deconstruct
30-
assert_equal [:authenticated], Authenticated[] .deconstruct
31-
assert_equal [:selected], Selected[] .deconstruct
32-
assert_equal [:logout], Logout[] .deconstruct
33-
end
28+
# TODO: TruffleRuby's Data fails these
29+
assert_equal [:not_authenticated], NotAuthenticated[].deconstruct
30+
assert_equal [:authenticated], Authenticated[] .deconstruct
31+
assert_equal [:selected], Selected[] .deconstruct
32+
assert_equal [:logout], Logout[] .deconstruct
3433
end
3534

3635
test "#deconstruct_keys" do
37-
pend_if_truffleruby "TruffleRuby bug overriding ::Data methods" do
38-
assert_equal({symbol: :not_authenticated}, NotAuthenticated[].deconstruct_keys([:symbol]))
39-
assert_equal({symbol: :authenticated}, Authenticated[] .deconstruct_keys([:symbol]))
40-
assert_equal({symbol: :selected}, Selected[] .deconstruct_keys([:symbol]))
41-
assert_equal({symbol: :logout}, Logout[] .deconstruct_keys([:symbol]))
42-
assert_equal({name: "not_authenticated"}, NotAuthenticated[].deconstruct_keys([:name]))
43-
assert_equal({name: "authenticated"}, Authenticated[] .deconstruct_keys([:name]))
44-
assert_equal({name: "selected"}, Selected[] .deconstruct_keys([:name]))
45-
assert_equal({name: "logout"}, Logout[] .deconstruct_keys([:name]))
46-
end
36+
# TODO: TruffleRuby's Data fails these
37+
assert_equal({symbol: :not_authenticated}, NotAuthenticated[].deconstruct_keys([:symbol]))
38+
assert_equal({symbol: :authenticated}, Authenticated[] .deconstruct_keys([:symbol]))
39+
assert_equal({symbol: :selected}, Selected[] .deconstruct_keys([:symbol]))
40+
assert_equal({symbol: :logout}, Logout[] .deconstruct_keys([:symbol]))
41+
assert_equal({name: "not_authenticated"}, NotAuthenticated[].deconstruct_keys([:name]))
42+
assert_equal({name: "authenticated"}, Authenticated[] .deconstruct_keys([:name]))
43+
assert_equal({name: "selected"}, Selected[] .deconstruct_keys([:name]))
44+
assert_equal({name: "logout"}, Logout[] .deconstruct_keys([:name]))
4745
end
4846

4947
test "#not_authenticated?" do

test/net/imap/test_data_lite.rb

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def test_inspect
154154
end
155155

156156
def test_recursive_inspect
157+
# TODO: TruffleRuby's Data fails this test with a StackOverflowError
157158
klass = Data.define(:value, :head, :tail) do
158159
def initialize(value:, head: nil, tail: nil)
159160
case tail
@@ -174,32 +175,32 @@ def initialize(value:, head: nil, tail: nil)
174175
end
175176
end
176177

177-
pend_if_jruby do
178-
# anonymous class
179-
list = klass[value: 1, tail: [2, 3, 4]]
180-
seen = "#<data #{klass.inspect}:...>"
181-
assert_equal(
182-
"#<data value=1, head=nil," \
183-
" tail=#<data value=2, head=#{seen}," \
184-
" tail=#<data value=3, head=#{seen}," \
185-
" tail=#<data value=4, head=#{seen}," \
186-
" tail=nil>>>>",
187-
list.inspect
188-
)
189-
190-
# named class
191-
Object.const_set(:DoubleLinkList, klass)
192-
list = DoubleLinkList[value: 1, tail: [2, 3, 4]]
193-
seen = "#<data DoubleLinkList:...>"
194-
assert_equal(
195-
"#<data DoubleLinkList value=1, head=nil," \
196-
" tail=#<data DoubleLinkList value=2, head=#{seen}," \
197-
" tail=#<data DoubleLinkList value=3, head=#{seen}," \
198-
" tail=#<data DoubleLinkList value=4, head=#{seen}," \
199-
" tail=nil>>>>",
200-
list.inspect
201-
)
202-
end
178+
# anonymous class
179+
list = klass[value: 1, tail: [2, 3, 4]]
180+
seen = "#<data #{klass.inspect}:...>"
181+
assert_equal(
182+
"#<data value=1, head=nil," \
183+
" tail=#<data value=2, head=#{seen}," \
184+
" tail=#<data value=3, head=#{seen}," \
185+
" tail=#<data value=4, head=#{seen}," \
186+
" tail=nil>>>>",
187+
# TODO: JRuby's Data fails on the next line
188+
list.inspect
189+
)
190+
191+
# named class
192+
Object.const_set(:DoubleLinkList, klass)
193+
list = DoubleLinkList[value: 1, tail: [2, 3, 4]]
194+
seen = "#<data DoubleLinkList:...>"
195+
assert_equal(
196+
"#<data DoubleLinkList value=1, head=nil," \
197+
" tail=#<data DoubleLinkList value=2, head=#{seen}," \
198+
" tail=#<data DoubleLinkList value=3, head=#{seen}," \
199+
" tail=#<data DoubleLinkList value=4, head=#{seen}," \
200+
" tail=nil>>>>",
201+
# TODO: JRuby's Data fails on the next line
202+
list.inspect
203+
)
203204
ensure
204205
Object.instance_eval { remove_const(:DoubleLinkList) } rescue nil
205206
end
@@ -350,6 +351,7 @@ class Inherited < Abstract.define(:foo)
350351
end
351352

352353
def test_subclass_can_create
354+
# TODO: JRuby's Data fails all of these
353355
assert_equal 1, Inherited[1] .foo
354356
assert_equal 2, Inherited[foo: 2].foo
355357
assert_equal 3, Inherited.new(3).foo
@@ -364,9 +366,8 @@ class InheritsClassMethod < AbstractWithClassMethod.define(:foo)
364366
end
365367

366368
def test_subclass_class_method
367-
pend_if_jruby do
368-
assert_equal :ok, InheritsClassMethod.inherited_class_method
369-
end
369+
# TODO: JRuby's Data fails on the next line
370+
assert_equal :ok, InheritsClassMethod.inherited_class_method
370371
end
371372

372373
class AbstractWithOverride < Data
@@ -377,10 +378,10 @@ class InheritsOverride < AbstractWithOverride.define(:foo)
377378
end
378379

379380
def test_subclass_override_deconstruct
381+
# TODO: JRuby's Data fails on the next line
380382
data = InheritsOverride[:foo]
381-
pend_if_truffleruby do
382-
assert_equal %i[ok foo], data.deconstruct
383-
end
383+
# TODO: TruffleRuby's Data fails on the next line
384+
assert_equal %i[ok foo], data.deconstruct
384385
end
385386

386387
end

test/net/imap/test_vanished_data.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ class VanishedDataTest < Net::IMAP::TestCase
5454
end
5555

5656
test ".[], mixing args raises ArgumentError" do
57-
pend_if_jruby do
58-
assert_raise ArgumentError do
59-
VanishedData[1, true, uids: "1", earlier: true]
60-
end
61-
assert_raise ArgumentError do VanishedData["1234", earlier: true] end
62-
assert_raise ArgumentError do VanishedData[nil, true, uids: "1"] end
57+
assert_raise ArgumentError do
58+
VanishedData[1, true, uids: "1", earlier: true]
6359
end
60+
assert_raise ArgumentError do VanishedData["1234", earlier: true] end
61+
assert_raise ArgumentError do VanishedData[nil, true, uids: "1"] end
6462
end
6563

6664
test ".[], missing args raises ArgumentError" do

0 commit comments

Comments
 (0)