Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable specs for StaticArray#sort_by on broken targets #11359

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions spec/std/static_array_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -263,29 +263,35 @@ describe "StaticArray" do
end
end

describe "{{ sort }}_by" do
it "sorts by" do
a = StaticArray["foo", "a", "hello"]
b = a.{{ sort }}_by(&.size)
b.should eq(StaticArray["a", "foo", "hello"])
a.should_not eq(b)
end
end

describe "{{ sort }}_by!" do
it "sorts by!" do
a = StaticArray["foo", "a", "hello"]
a.{{ sort }}_by!(&.size)
a.should eq(StaticArray["a", "foo", "hello"])
{% unless flag?(:aarch64) && (flag?(:musl) || flag?(:darwin)) %}
# Deactivated due to https://github.com/crystal-lang/crystal/issues/11358
straight-shoota marked this conversation as resolved.
Show resolved Hide resolved
describe "{{ sort }}_by" do
it "sorts by" do
a = StaticArray["foo", "a", "hello"]
b = a.{{ sort }}_by(&.size)
b.should eq(StaticArray["a", "foo", "hello"])
a.should_not eq(b)
end
end

it "calls given block exactly once for each element" do
calls = Hash(String, Int32).new(0)
a = StaticArray["foo", "a", "hello"]
a.{{ sort }}_by! { |e| calls[e] += 1; e.size }
calls.should eq({"foo" => 1, "a" => 1, "hello" => 1})
describe "{{ sort }}_by!" do
it "sorts by!" do
a = StaticArray["foo", "a", "hello"]
a.{{ sort }}_by!(&.size)
a.should eq(StaticArray["a", "foo", "hello"])
end

it "calls given block exactly once for each element" do
calls = Hash(String, Int32).new(0)
a = StaticArray["foo", "a", "hello"]
a.{{ sort }}_by! { |e| calls[e] += 1; e.size }
calls.should eq({"foo" => 1, "a" => 1, "hello" => 1})
end
end
end
{% else %}
pending "{{ sort }}_by"
pending "{{ sort }}_by!"
{% end %}
{% end %}

it_iterates "#each", [1, 2, 3], StaticArray[1, 2, 3].each
Expand Down