Skip to content

Commit

Permalink
Skip tests that depend on error checking when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
icy-arctic-fox committed Oct 23, 2021
1 parent 7fe9bd3 commit 4667d10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/gloop/buffer/bind_target_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Spectator.describe Gloop::Buffer::BindTarget do
end

it "raises on out-of-range values" do
skip_if_error_checking_disabled
expect { target[-100..100] }.to raise_error(Gloop::InvalidValueError)
end
end
Expand All @@ -180,10 +181,12 @@ Spectator.describe Gloop::Buffer::BindTarget do
end

it "raises on negative counts" do
skip_if_error_checking_disabled
expect { target[-1, -2] }.to raise_error(ArgumentError)
end

it "raises on out-of-range values" do
skip_if_error_checking_disabled
expect { target[-100, 100] }.to raise_error(Gloop::InvalidValueError)
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/gloop/buffer_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Spectator.describe Gloop::Buffer do
end

it "raises on out-of-range values" do
skip_if_error_checking_disabled
expect { buffer[-100..100] }.to raise_error(Gloop::InvalidValueError)
end
end
Expand All @@ -229,10 +230,12 @@ Spectator.describe Gloop::Buffer do
end

it "raises on negative counts" do
skip_if_error_checking_disabled
expect { buffer[-1, -2] }.to raise_error(ArgumentError)
end

it "raises on out-of-range values" do
skip_if_error_checking_disabled
expect { buffer[-100, 100] }.to raise_error(Gloop::InvalidValueError)
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/gloop/error_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Spectator.describe "Error handling" do
end

it "returns an error" do
skip_if_error_checking_disabled
is_expected.to eq(Gloop::Error::InvalidEnum)
end
end
Expand Down
6 changes: 6 additions & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def context
CONTEXT_WRAPPER[0]? || raise("Context not created")
end

macro skip_if_error_checking_disabled
{% if flag?(:release) && !flag?(:error_checking) %}
skip "Error checking disabled, compile with -Derror_checking to enable."
{% end %}
end

Spectator.configure do |config|
config.before_suite do
init_opengl
Expand Down

0 comments on commit 4667d10

Please sign in to comment.