Skip to content

Commit

Permalink
Remove most uses of Symbol variables in standard library specs (#12462
Browse files Browse the repository at this point in the history
)
  • Loading branch information
HertzDevil authored Sep 10, 2022
1 parent 9a2c847 commit 64bee9f
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 139 deletions.
8 changes: 4 additions & 4 deletions spec/std/array_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ describe "Array" do
end

it "works with mixed types" do
[1, "a", 1.0, :a].values_at(0, 1, 2, 3).should eq({1, "a", 1.0, :a})
[1, "a", 1.0, 'a'].values_at(0, 1, 2, 3).should eq({1, "a", 1.0, 'a'})
end
end

Expand Down Expand Up @@ -1819,9 +1819,9 @@ describe "Array" do

describe "transpose" do
it "transposes elements" do
[[:a, :b], [:c, :d], [:e, :f]].transpose.should eq([[:a, :c, :e], [:b, :d, :f]])
[[:a, :c, :e], [:b, :d, :f]].transpose.should eq([[:a, :b], [:c, :d], [:e, :f]])
[[:a]].transpose.should eq([[:a]])
[['a', 'b'], ['c', 'd'], ['e', 'f']].transpose.should eq([['a', 'c', 'e'], ['b', 'd', 'f']])
[['a', 'c', 'e'], ['b', 'd', 'f']].transpose.should eq([['a', 'b'], ['c', 'd'], ['e', 'f']])
[['a']].transpose.should eq([['a']])
end

it "transposes union of arrays" do
Expand Down
2 changes: 1 addition & 1 deletion spec/std/deque_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe "Deque" do

it "compares other types" do
a = Deque{1, 2, 3}
b = Deque{:foo, :bar}
b = Deque{true, false}
c = "other type"
(a == b).should be_false
(b == c).should be_false
Expand Down
8 changes: 4 additions & 4 deletions spec/std/enumerable_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1289,17 +1289,17 @@ describe "Enumerable" do

describe "to_h" do
it "for tuples" do
hash = Tuple.new({:a, 1}, {:c, 2}).to_h
hash.should be_a(Hash(Symbol, Int32))
hash.should eq({:a => 1, :c => 2})
hash = Tuple.new({"a", 1}, {"c", 2}).to_h
hash.should be_a(Hash(String, Int32))
hash.should eq({"a" => 1, "c" => 2})

hash = Tuple.new({1, 1.0}, {'a', "aaa"}).to_h
hash.should be_a(Hash(Int32 | Char, Float64 | String))
hash.should eq({1 => 1.0, 'a' => "aaa"})
end

it "for array" do
[[:a, :b], [:c, :d]].to_h.should eq({:a => :b, :c => :d})
[['a', 'b'], ['c', 'd']].to_h.should eq({'a' => 'b', 'c' => 'd'})
end

it "with block" do
Expand Down
Loading

0 comments on commit 64bee9f

Please sign in to comment.