Permalink
Browse files

remove ill-advised old set constructor. closes #5910

  • Loading branch information...
1 parent 60603bf commit 2d0e7313b3823d1be6ae74ad7b1879a581971ba9 @JeffBezanson JeffBezanson committed Feb 23, 2014
Showing with 14 additions and 17 deletions.
  1. +0 −3 base/set.jl
  2. +14 −14 test/collections.jl
View
@@ -3,9 +3,6 @@ type Set{T}
Set() = new(Dict{T,Nothing}())
Set(itr) = union!(new(Dict{T,Nothing}()), itr)
-
- # for backwards compat
- Set(xs::T...) = Set{T}(xs)
end
Set() = Set{Any}()
Set(itr) = Set{eltype(itr)}(itr)
View
@@ -389,34 +389,34 @@ end
@test isempty(s)
# hash
-s1 = Set{ASCIIString}("bar", "foo")
-s2 = Set{ASCIIString}("foo", "bar")
-s3 = Set{ASCIIString}("baz")
+s1 = Set{ASCIIString}(["bar", "foo"])
+s2 = Set{ASCIIString}(["foo", "bar"])
+s3 = Set{ASCIIString}(["baz"])
@test hash(s1) == hash(s2)
@test hash(s1) != hash(s3)
# isequal
@test isequal(Set(), Set())
@test !isequal(Set(), Set(1))
-@test isequal(Set{Any}(1,2), Set{Int}(1,2))
-@test !isequal(Set{Any}(1,2), Set{Int}(1,2,3))
+@test isequal(Set{Any}({1,2}), Set{Int}([1,2]))
+@test !isequal(Set{Any}({1,2}), Set{Int}([1,2,3]))
# Comparison of unrelated types seems rather inconsistent
@test isequal(Set{Int}(), Set{String}())
-@test !isequal(Set{Int}(), Set{String}(""))
-@test !isequal(Set{String}(), Set{Int}(0))
-@test !isequal(Set{Int}(1), Set{String}())
+@test !isequal(Set{Int}(), Set{String}([""]))
+@test !isequal(Set{String}(), Set{Int}([0]))
+@test !isequal(Set{Int}([1]), Set{String}())
-@test isequal(Set{Any}(1,2,3), Set{Int}(1,2,3))
-@test isequal(Set{Int}(1,2,3), Set{Any}(1,2,3))
+@test isequal(Set{Any}([1,2,3]), Set{Int}([1,2,3]))
+@test isequal(Set{Int}([1,2,3]), Set{Any}([1,2,3]))
-@test !isequal(Set{Any}(1,2,3), Set{Int}(1,2,3,4))
-@test !isequal(Set{Int}(1,2,3), Set{Any}(1,2,3,4))
+@test !isequal(Set{Any}([1,2,3]), Set{Int}([1,2,3,4]))
+@test !isequal(Set{Int}([1,2,3]), Set{Any}([1,2,3,4]))
-@test !isequal(Set{Any}(1,2,3,4), Set{Int}(1,2,3))
-@test !isequal(Set{Int}(1,2,3,4), Set{Any}(1,2,3))
+@test !isequal(Set{Any}([1,2,3,4]), Set{Int}([1,2,3]))
+@test !isequal(Set{Int}([1,2,3,4]), Set{Any}([1,2,3]))
# ########## end of set tests ##########

0 comments on commit 2d0e731

Please sign in to comment.