Skip to content

Commit d4a7fd2

Browse files
committed
[GR-17457] Fix InteropLibrary methods spec
PullRequest: truffleruby/2216
2 parents db23fce + 51f87f9 commit d4a7fd2

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

spec/truffle/interop/methods_spec.rb

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@
1111
require_relative '../../ruby/spec_helper'
1212

1313
describe "Truffle::Interop" do
14-
it "has a method for each InteropLibrary message" do
15-
all_methods = Primitive.interop_library_all_methods
16-
all_methods -= %w[getFactory getUncached]
17-
expected = all_methods.map do |name|
18-
name = name.gsub(/([a-z])([A-Z])/) { "#{$1}_#{$2.downcase}" }
19-
if name.start_with?('is_', 'has_', 'fits_')
20-
name += '?'
21-
end
22-
if name.start_with?('is_')
23-
name = name[3..-1]
24-
elsif name.start_with?('get_')
25-
name = name[4..-1]
26-
end
27-
name.to_sym
28-
end.sort
14+
# Run locally and in TruffleRuby's CI but not in GraalVM's CI to not prevent adding new interop messages
15+
guard -> { !ENV.key?('BUILD_URL') or ENV.key?('TRUFFLERUBY_CI') } do
16+
it "has a method for each InteropLibrary message" do
17+
all_methods = Primitive.interop_library_all_methods
18+
expected = all_methods.map do |name|
19+
name = name.gsub(/([a-z])([A-Z])/) { "#{$1}_#{$2.downcase}" }
20+
if name.start_with?('is_', 'has_', 'fits_')
21+
name += '?'
22+
end
23+
if name.start_with?('is_')
24+
name = name[3..-1]
25+
elsif name.start_with?('get_')
26+
name = name[4..-1]
27+
end
28+
name.to_sym
29+
end.sort
2930

30-
actual = Truffle::Interop.methods.sort
31+
actual = Truffle::Interop.methods.sort
3132

32-
# pp expected
33-
# pp actual
34-
(expected - actual).should == []
33+
# pp expected
34+
# pp actual
35+
(expected - actual).should == []
36+
end
3537
end
3638
end

src/main/java/org/truffleruby/interop/InteropNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected RubyArray allMethodsOfInteropLibrary() {
123123
private static String[] publicInteropLibraryMethods() {
124124
List<String> methods = new ArrayList<>();
125125
for (Method method : InteropLibrary.class.getDeclaredMethods()) {
126-
if (Modifier.isPublic(method.getModifiers())) {
126+
if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers())) {
127127
if (!methods.contains(method.getName())) {
128128
methods.add(method.getName());
129129
}

0 commit comments

Comments
 (0)