-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into truffle-head
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
Showing
45 changed files
with
815 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Attachments.attach" do | ||
|
||
def fixture | ||
x = 14 | ||
y = 15 | ||
y = 16 | ||
x | ||
end | ||
|
||
after :all do | ||
[14, 15, 16].each do |line| | ||
Truffle::Attachments.detach __FILE__, line | ||
end | ||
end | ||
|
||
it "returns nil" do | ||
Truffle::Attachments.attach(__FILE__, 14){}.should be_nil | ||
end | ||
|
||
it "installs a block to be run on a line" do | ||
scratch = [false] | ||
Truffle::Attachments.attach __FILE__, 14 do | ||
scratch[0] = true | ||
end | ||
fixture.should == 14 | ||
scratch[0].should be_true | ||
end | ||
|
||
it "allows multiple blocks to be installed on the same line and runs them in an indeterminate order" do | ||
scratch = [] | ||
Truffle::Attachments.attach __FILE__, 14 do | ||
scratch << 1 | ||
end | ||
Truffle::Attachments.attach __FILE__, 14 do | ||
scratch << 2 | ||
end | ||
fixture.should == 14 | ||
scratch.sort.should == [1, 2] | ||
end | ||
|
||
it "supplies a Binding to the block" do | ||
Truffle::Attachments.attach __FILE__, 14 do |binding| | ||
binding.should be_kind_of(Binding) | ||
end | ||
fixture.should == 14 | ||
end | ||
|
||
it "allows read access to local variables in the block" do | ||
Truffle::Attachments.attach __FILE__, 15 do |binding| | ||
binding.local_variable_get(:x).should == 14 | ||
end | ||
fixture.should == 14 | ||
end | ||
|
||
it "allows write access to local variables in the block" do | ||
Truffle::Attachments.attach __FILE__, 15 do |binding| | ||
binding.local_variable_set(:x, 100) | ||
end | ||
fixture.should == 100 | ||
end | ||
|
||
it "runs the block before running the line" do | ||
Truffle::Attachments.attach __FILE__, 16 do |binding| | ||
binding.local_variable_get(:x).should == 14 | ||
binding.local_variable_get(:y).should == 15 | ||
end | ||
fixture.should == 14 | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Attachments.attach" do | ||
|
||
def fixture | ||
x = 14 | ||
x | ||
end | ||
|
||
it "returns nil" do | ||
Truffle::Attachments.detach(__FILE__, 14).should be_nil | ||
end | ||
|
||
it "removes a previous attachment" do | ||
scratch = [] | ||
|
||
scratch[0] = false | ||
Truffle::Attachments.attach __FILE__, 14 do | ||
scratch[0] = true | ||
end | ||
fixture.should == 14 | ||
scratch[0].should be_true | ||
|
||
scratch[0] = false | ||
Truffle::Attachments.detach __FILE__, 14 | ||
fixture.should == 14 | ||
scratch[0].should be_false | ||
end | ||
|
||
it "removes multiple previous attachments" do | ||
scratch = [] | ||
Truffle::Attachments.attach __FILE__, 14 do | ||
scratch << 1 | ||
end | ||
Truffle::Attachments.attach __FILE__, 14 do | ||
scratch << 2 | ||
end | ||
fixture.should == 14 | ||
scratch.sort.should == [1, 2] | ||
|
||
Truffle::Attachments.detach __FILE__, 14 | ||
fixture.should == 14 | ||
scratch.sort.should == [1, 2] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../ruby/spec_helper' | ||
|
||
describe "Truffle.binding_of_caller" do | ||
|
||
it "returns a Binding" do | ||
Truffle.binding_of_caller.should be_kind_of(Binding) | ||
end | ||
|
||
it "gives read access to local variables at the call site" do | ||
x = 14 | ||
Truffle.binding_of_caller.local_variable_get(:x).should == 14 | ||
end | ||
|
||
it "gives write access to local variables at the call site" do | ||
x = 2 | ||
Truffle.binding_of_caller.local_variable_set(:x, 14) | ||
x.should == 14 | ||
end | ||
|
||
it "works through #send" do | ||
x = 14 | ||
Truffle.send(:binding_of_caller).local_variable_get(:x).should == 14 | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <ruby.h> | ||
|
||
#include "add.h" | ||
|
||
VALUE add(VALUE self, VALUE a, VALUE b) { | ||
return INT2NUM(NUM2INT(a) + NUM2INT(b)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VALUE add(VALUE self, VALUE a, VALUE b); |
3 changes: 3 additions & 0 deletions
3
spec/truffle/specs/truffle/cext/fixtures/foo/ext/foo/extconf.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'mkmf' | ||
$CFLAGS << ' -Wall' | ||
create_makefile('foo/foo') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <ruby.h> | ||
|
||
#include "add.h" | ||
|
||
void Init_foo() { | ||
VALUE Foo = rb_define_module("Foo"); | ||
rb_define_method(Foo, "add", add, 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::CExt.inline" do | ||
|
||
if Truffle::CExt.supported? | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
else | ||
|
||
it "raises a RuntimeError" do | ||
lambda { | ||
Truffle::CExt.inline %{ #include <unistd.h> }, %{ getpid(); } | ||
}.should raise_error(RuntimeError) | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::CExt.load_extconf" do | ||
|
||
if Truffle::CExt.supported? | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
else | ||
|
||
it "raises a RuntimeError" do | ||
lambda { | ||
Truffle::CExt.load_extconf File.expand_path('fixtures/foo/ext/foo/extconf.rb', __FILE__) | ||
}.should raise_error(RuntimeError) | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::CExt.load_files" do | ||
|
||
if Truffle::CExt.supported? | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
else | ||
|
||
it "raises a RuntimeError" do | ||
files = [ | ||
File.expand_path('fixtures/foo/ext/foo/foo.c', __FILE__), | ||
File.expand_path('fixtures/foo/ext/foo/add.c', __FILE__) | ||
] | ||
lambda { | ||
Truffle::CExt.load_files ['Init_foo'], [], files | ||
}.should raise_error(RuntimeError) | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::CExt.load_string" do | ||
|
||
if Truffle::CExt.supported? | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
else | ||
|
||
it "raises a RuntimeError" do | ||
source = %{ | ||
void Init_foo() { | ||
} | ||
} | ||
lambda { | ||
Truffle::CExt.load_files ['Init_foo'], [], source | ||
}.should raise_error(RuntimeError) | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::CExt.supported?" do | ||
|
||
it "returns a Boolean value" do | ||
Truffle::CExt.supported?.should be_true_or_false | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Debug.break" do | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Debug.clear" do | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../ruby/spec_helper' | ||
|
||
describe "Truffle.graal?" do | ||
|
||
it "returns a Boolean value" do | ||
Truffle.graal?.should be_true_or_false | ||
end | ||
|
||
end |
23 changes: 23 additions & 0 deletions
23
spec/truffle/specs/truffle/primitive/assert_constant_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.assert_constant" do | ||
|
||
it "raises a RuntimeError when called dynamically" do | ||
lambda{ Truffle::Primitive.send(:assert_constant, 14 + 2) }.should raise_error(RuntimeError) | ||
end | ||
|
||
unless Truffle.graal? | ||
it "returns nil" do | ||
Truffle::Primitive.assert_constant(14 + 2).should be_nil | ||
end | ||
end | ||
|
||
end |
23 changes: 23 additions & 0 deletions
23
spec/truffle/specs/truffle/primitive/assert_not_compiled_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.assert_not_compiled" do | ||
|
||
it "raises a RuntimeError when called dynamically" do | ||
lambda{ Truffle::Primitive.send(:assert_not_compiled) }.should raise_error(RuntimeError) | ||
end | ||
|
||
unless Truffle.graal? | ||
it "returns nil" do | ||
Truffle::Primitive.assert_not_compiled.should be_nil | ||
end | ||
end | ||
|
||
end |
19 changes: 19 additions & 0 deletions
19
spec/truffle/specs/truffle/primitive/coverage_result_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.coverage_result" do | ||
|
||
it "returns nil" do | ||
Truffle::Primitive.coverage_result.should be_nil | ||
end | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
end |
19 changes: 19 additions & 0 deletions
19
spec/truffle/specs/truffle/primitive/coverage_start_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.coverage_start" do | ||
|
||
it "returns nil" do | ||
Truffle::Primitive.coverage_start.should be_nil | ||
end | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.gc_count" do | ||
|
||
it "returns an Integer" do | ||
Truffle::Primitive.gc_count.should be_kind_of(Integer) | ||
end | ||
|
||
it "increases as collections are run" do | ||
count_before = Truffle::Primitive.gc_count | ||
escape = [] | ||
100_000.times do | ||
escape << Time.now.to_s | ||
end | ||
Truffle::Primitive.gc_count.should > count_before | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.gc_time" do | ||
|
||
it "returns an Integer" do | ||
Truffle::Primitive.gc_time.should be_kind_of(Integer) | ||
end | ||
|
||
it "increases as collections are run" do | ||
time_before = Truffle::Primitive.gc_time | ||
escape = [] | ||
100_000.times do | ||
escape << Time.now.to_s | ||
end | ||
Truffle::Primitive.gc_time.should > time_before | ||
end | ||
|
||
end |
21 changes: 21 additions & 0 deletions
21
spec/truffle/specs/truffle/primitive/home_directory_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.home_directory" do | ||
|
||
it "returns a String" do | ||
Truffle::Primitive.home_directory.should be_kind_of(String) | ||
end | ||
|
||
it "returns a path to a directory" do | ||
Dir.exist?(Truffle::Primitive.home_directory).should be_true | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.host_os" do | ||
|
||
it "returns a String" do | ||
Truffle::Primitive.host_os.should be_kind_of(String) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Primitive.simple_shell" do | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Runtime.debug_print" do | ||
|
||
it "needs to be reviewed for spec completeness" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Runtime.dump_string" do | ||
|
||
it "returns a String" do | ||
Truffle::Runtime.dump_string('foo').should be_kind_of(String) | ||
end | ||
|
||
it "returns a sequence of escaped bytes in lower case" do | ||
Truffle::Runtime.dump_string('foo').should =~ /(\\x[0-9a-f][0-9a-f])+/ | ||
end | ||
|
||
it "returns correct bytes for the given string" do | ||
Truffle::Runtime.dump_string('foo').should == "\\x66\\x6f\\x6f" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../../ruby/spec_helper' | ||
|
||
describe "Truffle::Runtime.java_class_of" do | ||
|
||
it "returns a String" do | ||
Truffle::Runtime.java_class_of(14).should be_kind_of(String) | ||
end | ||
|
||
it "returns 'Boolean' for true" do | ||
Truffle::Runtime.java_class_of(true).should == 'Boolean' | ||
end | ||
|
||
it "returns 'Boolean' for false" do | ||
Truffle::Runtime.java_class_of(false).should == 'Boolean' | ||
end | ||
|
||
it "returns 'Integer' for a small Fixnum" do | ||
Truffle::Runtime.java_class_of(14).should == 'Integer' | ||
end | ||
|
||
it "returns 'Long' for a large Fixnum" do | ||
Truffle::Runtime.java_class_of(0xffffffffffff).should == 'Long' | ||
end | ||
|
||
it "returns 'Double' for a Float" do | ||
Truffle::Runtime.java_class_of(3.14).should == 'Double' | ||
end | ||
|
||
it "returns 'RubyString' for a String" do | ||
Truffle::Runtime.java_class_of('test').should == 'RubyString' | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../ruby/spec_helper' | ||
|
||
describe "Truffle.source_of_caller" do | ||
|
||
it "returns a String" do | ||
Truffle.source_of_caller.should be_kind_of(String) | ||
end | ||
|
||
it "returns the name of the file at the call site" do | ||
Truffle.source_of_caller.should == __FILE__ | ||
end | ||
|
||
it "works through #send" do | ||
x = 14 | ||
Truffle.send(:source_of_caller).should == __FILE__ | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../ruby/spec_helper' | ||
|
||
describe "Truffle.substrate?" do | ||
|
||
it "returns a Boolean value" do | ||
Truffle.graal?.should be_true_or_false | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
require_relative '../../../ruby/spec_helper' | ||
|
||
describe "Truffle.version" do | ||
|
||
it "returns a String" do | ||
Truffle.version.should be_kind_of(String) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:Truffle::Attachments.attach allows multiple blocks to be installed on the same line and runs them in the order they were attached | ||
fails:Truffle::Attachments.attach allows write access to local variables in the block | ||
fails:Truffle::Attachments.attach runs the block before running the line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:Truffle.binding_of_caller gives read access to local variables at the call site | ||
fails:Truffle.binding_of_caller gives write access to local variables at the call site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Truffle::CExt.load_extconf raises a RuntimeError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Truffle::Primitive.coverage_result returns nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:Truffle::Primitive.coverage_start returns nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:Truffle.source_of_caller returns a String | ||
fails:Truffle.source_of_caller returns the name of the file at the call site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters