@@ -462,26 +462,26 @@ end
462
462
@test utime (z) == 1
463
463
@test ustrip (z) ≈ 60 * 60 * 24 * 365.25
464
464
465
- # Test that `u_str` respects original type:
466
- @test typeof (u " 1" ) == Int
467
- @test typeof (u " 1f0" ) == Float32
465
+ # Test type stability of extreme range of units
466
+ @test typeof (u " 1" ) == DEFAULT_QUANTITY_TYPE
467
+ @test typeof (u " 1f0" ) == DEFAULT_QUANTITY_TYPE
468
468
@test typeof (u " s" ^ 2 ) == DEFAULT_QUANTITY_TYPE
469
469
@test typeof (u " Ω" ) == DEFAULT_QUANTITY_TYPE
470
470
@test typeof (u " Gyr" ) == DEFAULT_QUANTITY_TYPE
471
471
@test typeof (u " fm" ) == DEFAULT_QUANTITY_TYPE
472
472
@test typeof (u " fm" ^ 2 ) == DEFAULT_QUANTITY_TYPE
473
473
474
- # Can also use tuples:
475
- @test typeof (u " (m, s)" ) == Tuple{DEFAULT_QUANTITY_TYPE, DEFAULT_QUANTITY_TYPE}
474
+ @test_throws ErrorException eval (:(u " :x" ))
476
475
477
- @test_throws LoadError eval (:(u " x" ))
478
476
VERSION >= v " 1.9" && @test_throws " Symbol x not found" uparse (" x" )
479
477
VERSION >= v " 1.9" && @test_throws " Symbol c found in `Constants` but not `Units`" uparse (" c" )
480
478
VERSION >= v " 1.9" && @test_throws " Unexpected expression" uparse (" import ..Units" )
479
+ VERSION >= v " 1.9" && @test_throws " Unexpected expression" uparse (" (m, m)" )
481
480
@test_throws LoadError eval (:(us " x" ))
482
481
VERSION >= v " 1.9" && @test_throws " Symbol x not found" sym_uparse (" x" )
483
482
VERSION >= v " 1.9" && @test_throws " Symbol c found in `SymbolicConstants` but not `SymbolicUnits`" sym_uparse (" c" )
484
483
VERSION >= v " 1.9" && @test_throws " Unexpected expression" sym_uparse (" import ..Units" )
484
+ VERSION >= v " 1.9" && @test_throws " Unexpected expression" sym_uparse (" (m, m)" )
485
485
end
486
486
487
487
@testset " Constants" begin
0 commit comments