Skip to content

Commit 54d7307

Browse files
kshyattNHDaly
authored andcommitted
Test that replace throws Method error for Pair arguments (#50901)
1 parent 6454613 commit 54d7307

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/sets.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,12 @@ end
810810
@test replace((NaN, 1.0), NaN=>0.0) === (0.0, 1.0)
811811
@test replace([1, missing], missing=>0) == [1, 0]
812812
@test replace((1, missing), missing=>0) === (1, 0)
813+
814+
# test that MethodError is thrown for pairs
815+
@test_throws MethodError replace(identity, 1=>2)
816+
@test_throws MethodError replace(identity, 1=>2, 3=>4)
817+
@test_throws MethodError replace!(identity, 1=>2)
818+
@test_throws MethodError replace!(identity, 1=>2, 3=>4)
813819
end
814820

815821
@testset "⊆, ⊊, ⊈, ⊇, ⊋, ⊉, <, <=, issetequal" begin

0 commit comments

Comments
 (0)