Skip to content

Commit a94bed6

Browse files
committed
Add test for bad function input
1 parent d42f98d commit a94bed6

File tree

6 files changed

+6
-0
lines changed

6 files changed

+6
-0
lines changed

test/MArray.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
@test (ex = macroexpand(:(@MArray Float64[1 2; 3])); isa(ex, Expr) && ex.head == :error)
6161
@test (ex = macroexpand(:(@MArray fill)); isa(ex, Expr) && ex.head == :error)
6262
@test (ex = macroexpand(:(@MArray ones)); isa(ex, Expr) && ex.head == :error)
63+
@test (ex = macroexpand(:(@MArray sin(1:5))); isa(ex, Expr) && ex.head == :error)
6364
@test (ex = macroexpand(:(@MArray fill())); isa(ex, Expr) && ex.head == :error)
6465
@test (ex = macroexpand(:(@MArray ones())); isa(ex, Expr) && ex.head == :error)
6566
@test (ex = macroexpand(:(@MArray fill(1))); isa(ex, Expr) && ex.head == :error)

test/MMatrix.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
@test (ex = macroexpand(:(@MMatrix fill(2.3, 4, 5, 6))); isa(ex, Expr) && ex.head == :error)
4747
@test (ex = macroexpand(:(@MMatrix ones(4, 5, 6, 7))); isa(ex, Expr) && ex.head == :error)
4848
@test (ex = macroexpand(:(@MMatrix ones)); isa(ex, Expr) && ex.head == :error)
49+
@test (ex = macroexpand(:(@MMatrix sin(1:5))); isa(ex, Expr) && ex.head == :error)
4950
@test (ex = macroexpand(:(@MMatrix eye(4, 5, 6, 7))); isa(ex, Expr) && ex.head == :error)
5051

5152
@test ((@MMatrix zeros(2,2))::MMatrix{2, 2, Float64}).data === (0.0, 0.0, 0.0, 0.0)

test/MVector.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
@test isa(@MVector(randexp(Float32, 2)), MVector{2, Float32})
3737
@test (ex = macroexpand(:(@MVector fill(1.5, 2, 3))); isa(ex, Expr) && ex.head == :error)
3838
@test (ex = macroexpand(:(@MVector ones(2, 3, 4))); isa(ex, Expr) && ex.head == :error)
39+
@test (ex = macroexpand(:(@MVector sin(1:5))); isa(ex, Expr) && ex.head == :error)
3940
@test (ex = macroexpand(:(@MVector [i*j for i in 1:2, j in 2:3])); isa(ex, Expr) && ex.head == :error)
4041
@test (ex = macroexpand(:(@MVector Float32[i*j for i in 1:2, j in 2:3])); isa(ex, Expr) && ex.head == :error)
4142
end

test/SArray.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
@test (ex = macroexpand(:(@SArray ones)); isa(ex, Expr) && ex.head == :error)
6060
@test (ex = macroexpand(:(@SArray fill)); isa(ex, Expr) && ex.head == :error)
6161
@test (ex = macroexpand(:(@SArray ones())); isa(ex, Expr) && ex.head == :error)
62+
@test (ex = macroexpand(:(@SArray sin(1:5))); isa(ex, Expr) && ex.head == :error)
6263
@test (ex = macroexpand(:(@SArray fill())); isa(ex, Expr) && ex.head == :error)
6364
@test (ex = macroexpand(:(@SArray fill(1))); isa(ex, Expr) && ex.head == :error)
6465
@test (ex = macroexpand(:(@SArray eye(5,6,7,8,9))); isa(ex, Expr) && ex.head == :error)

test/SMatrix.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
@test (ex = macroexpand(:(@SMatrix fill(1.5, 2, 3, 4))); isa(ex, Expr) && ex.head == :error)
4646
@test (ex = macroexpand(:(@SMatrix ones(2, 3, 4, 5))); isa(ex, Expr) && ex.head == :error)
4747
@test (ex = macroexpand(:(@SMatrix ones)); isa(ex, Expr) && ex.head == :error)
48+
@test (ex = macroexpand(:(@SMatrix sin(1:5))); isa(ex, Expr) && ex.head == :error)
4849
@test (ex = macroexpand(:(@SMatrix eye(2, 3, 4, 5))); isa(ex, Expr) && ex.head == :error)
4950

5051
@test ((@SMatrix fill(1.3, 2,2))::SMatrix{2, 2, Float64}).data === (1.3, 1.3, 1.3, 1.3)

test/SVector.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
@test (ex = macroexpand(:(@SVector fill(1.5, 2, 3))); isa(ex, Expr) && ex.head == :error)
4242
@test (ex = macroexpand(:(@SVector ones(2, 3, 4))); isa(ex, Expr) && ex.head == :error)
43+
@test (ex = macroexpand(:(@SVector sin(1:5))); isa(ex, Expr) && ex.head == :error)
4344
@test (ex = macroexpand(:(@SVector [i*j for i in 1:2, j in 2:3])); isa(ex, Expr) && ex.head == :error)
4445
@test (ex = macroexpand(:(@SVector Float32[i*j for i in 1:2, j in 2:3])); isa(ex, Expr) && ex.head == :error)
4546
end

0 commit comments

Comments
 (0)