Skip to content

Commit 6c9c28b

Browse files
committed
Add spec for Polyglot.import and Truffle::Interop.import
1 parent 9e1eea9 commit 6c9c28b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

spec/truffle/interop/import_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. This
2+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
3+
# redistribute it and/or modify it under the terms of the:
4+
#
5+
# Eclipse Public License version 1.0, or
6+
# GNU General Public License version 2, or
7+
# GNU Lesser General Public License version 2.1.
8+
9+
require_relative '../../ruby/spec_helper'
10+
11+
guard -> { Truffle::Interop.polyglot_access? } do
12+
describe "Truffle::Interop.import" do
13+
14+
it "imports an object" do
15+
object = Object.new
16+
Truffle::Interop.export :imports_an_object, object
17+
Truffle::Interop.import(:imports_an_object).should == object
18+
end
19+
20+
it "returns nil because Truffle::Interop.lookup_symbol returns nil if not found" do
21+
Truffle::Interop.import(:not_registered_export_test).should == nil
22+
end
23+
24+
end
25+
end

0 commit comments

Comments
 (0)