263263
264264# issues #43
265265@testset " macro error" begin
266- if VERSION < v " 1.3"
267- @test_throws LoadError @macroexpand (IrrationalConstants. @irrational Myπ big (π) Myπ)
268- @test_throws LoadError @macroexpand (IrrationalConstants. @irrational Myπ 1.0 big (π) Myπ)
269- else
270- msg = " The name of the irrational constant (Myπ) and its type (Myπ) cannot be the same. Please choose a different name for the constant or specify a different type name as the last argument to the macro."
271- @test_throws ArgumentError (msg) @macroexpand (IrrationalConstants. @irrational Myπ big (π) Myπ)
272- @test_throws ArgumentError (msg) @macroexpand (IrrationalConstants. @irrational Myπ 1.0 big (π) Myπ)
273- end
266+ msg = " The name of the irrational constant (Myπ) and its type (Myπ) cannot be the same. Please choose a different name for the constant or specify a different type name as the last argument to the macro."
267+ @test_throws ArgumentError (msg) @macroexpand (IrrationalConstants. @irrational Myπ big (π) Myπ)
268+ @test_throws ArgumentError (msg) @macroexpand (IrrationalConstants. @irrational Myπ 1.0 big (π) Myπ)
274269end
275270
276271# test that defining a type that already exists throws an error
@@ -280,16 +275,10 @@ module TestTypeCollision
280275 struct MyExistingType end
281276
282277 @testset " type collision" begin
283- if VERSION < v " 1.3"
284- @test_throws LoadError @macroexpand (IrrationalConstants. @irrational myExistingType big (π))
285- @test_throws LoadError @macroexpand (IrrationalConstants. @irrational myconst big (π) MyExistingType)
286- @test_throws LoadError @macroexpand (IrrationalConstants. @irrational myconst 1.0 big (π) MyExistingType)
287- else
288- msg1 = " Type `MyExistingType` of irrational constant `myExistingType` is already defined in module `Main.TestTypeCollision`."
289- @test_throws ArgumentError (msg1) @macroexpand (IrrationalConstants. @irrational myExistingType big (π))
290- msg2 = " Type `MyExistingType` of irrational constant `myconst` is already defined in module `Main.TestTypeCollision`."
291- @test_throws ArgumentError (msg2) @macroexpand (IrrationalConstants. @irrational myconst big (π) MyExistingType)
292- @test_throws ArgumentError (msg2) @macroexpand (IrrationalConstants. @irrational myconst 1.0 big (π) MyExistingType)
293- end
278+ msg1 = " Type `MyExistingType` of irrational constant `myExistingType` is already defined in module `Main.TestTypeCollision`."
279+ @test_throws ArgumentError (msg1) @macroexpand (IrrationalConstants. @irrational myExistingType big (π))
280+ msg2 = " Type `MyExistingType` of irrational constant `myconst` is already defined in module `Main.TestTypeCollision`."
281+ @test_throws ArgumentError (msg2) @macroexpand (IrrationalConstants. @irrational myconst big (π) MyExistingType)
282+ @test_throws ArgumentError (msg2) @macroexpand (IrrationalConstants. @irrational myconst 1.0 big (π) MyExistingType)
294283 end
295284end
0 commit comments