Skip to content

Commit

Permalink
Run primitives_spec with the interpreter on CI (#14438)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil authored Apr 16, 2024
1 parent 5297fd0 commit 5cc46eb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/interpreter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,24 @@ jobs:

- name: Run std_spec with interpreter
run: SPEC_SPLIT="${{ matrix.part }}%4" bin/crystal i spec/std_spec.cr -- --junit_output .junit/interpreter-std_spec.${{ matrix.part }}.xml

test-interpreter-primitives_spec:
needs: build-interpreter
runs-on: ubuntu-22.04
container:
image: crystallang/crystal:1.11.2-build
name: "Test primitives_spec with interpreter"
steps:
- uses: actions/checkout@v4

- name: Download compiler artifact
uses: actions/download-artifact@v4
with:
name: crystal-interpreter
path: .build/

- name: Mark downloaded compiler as executable
run: chmod +x .build/crystal

- name: Run primitives_spec with interpreter
run: bin/crystal i spec/primitives_spec.cr -- --junit_output .junit/interpreter-primitives_spec.xml
1 change: 1 addition & 0 deletions spec/primitives/float_spec.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "spec"
require "../support/number"
require "../support/interpreted"

describe "Primitives: Float" do
{% for op in %w(== != < <= > >=) %}
Expand Down
6 changes: 4 additions & 2 deletions spec/primitives/reference_spec.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "spec"
require "../support/interpreted"

private abstract class Base
end
Expand Down Expand Up @@ -36,7 +37,8 @@ describe "Primitives: reference" do
end
end

describe ".pre_initialize" do
# TODO: implement in the interpreter
pending_interpreted describe: ".pre_initialize" do
it "doesn't fail on complex ivar initializer if value is discarded (#14325)" do
bar_buffer = GC.malloc(instance_sizeof(Outer))
Outer.pre_initialize(bar_buffer)
Expand Down Expand Up @@ -87,7 +89,7 @@ describe "Primitives: reference" do
end
end

describe ".unsafe_construct" do
pending_interpreted describe: ".unsafe_construct" do
it "constructs an object in-place" do
foo_buffer = GC.malloc(instance_sizeof(Foo))
foo = Foo.unsafe_construct(foo_buffer, 123_i64)
Expand Down
4 changes: 3 additions & 1 deletion spec/primitives/slice_spec.cr
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
require "spec"
require "../support/number"
require "../support/interpreted"

describe "Primitives: Slice" do
describe ".literal" do
# TODO: implement in the interpreter
{% for num in BUILTIN_NUMBER_TYPES %}
it {{ "creates a read-only Slice(#{num})" }} do
pending_interpreted {{ "creates a read-only Slice(#{num})" }} do
slice = Slice({{ num }}).literal(0, 1, 4, 9, 16, 25)
slice.should be_a(Slice({{ num }}))
slice.to_a.should eq([0, 1, 4, 9, 16, 25] of {{ num }})
Expand Down

0 comments on commit 5cc46eb

Please sign in to comment.