Skip to content

Commit a365da0

Browse files
committed
Test custom unit raises error
1 parent e176d81 commit a365da0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ else
1616
@safetestset "Unit tests" begin
1717
include("unittests.jl")
1818
end
19-
end
19+
end

test/test_unitful.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,16 @@ for T in [DEFAULT_VALUE_TYPE, Float16, Float32, Float64], R in [DEFAULT_DIM_BASE
2525

2626
@test typeof(convert(DynamicQuantities.Dimensions, Unitful.dimension(x_unitful))) == DynamicQuantities.Dimensions{DEFAULT_DIM_BASE_TYPE}
2727
end
28+
29+
module MyScaleUnit
30+
using Unitful
31+
@dimension(𝐒, "𝐒", Scale)
32+
@refunit(scale, "scale", Scale, 𝐒, false)
33+
end
34+
35+
Unitful.register(MyScaleUnit)
36+
37+
x = 1.0u"scale"
38+
@test typeof(x) <: Unitful.Quantity{Float64, MyScaleUnit.𝐒}
39+
@test_throws ErrorException convert(DynamicQuantities.Quantity, x)
40+
# These are not supported because there is no SI equivalency

0 commit comments

Comments
 (0)