From a264a5db998b267a285876249c27f956874e09ba Mon Sep 17 00:00:00 2001 From: kshyatt Date: Thu, 1 Feb 2018 12:33:43 -0800 Subject: [PATCH] Two small tests for enums --- test/enums.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/enums.jl b/test/enums.jl index 6f4a5a8e145ce..69e30c5a550ba 100644 --- a/test/enums.jl +++ b/test/enums.jl @@ -18,6 +18,7 @@ macro macrocall(ex) end @test_throws ArgumentError("no arguments given for Enum Foo") @macrocall(@enum Foo) +@test_throws ArgumentError("invalid base type for Enum Foo2, Foo2::Float64=::Float64; base type must be an integer primitive type") @macrocall(@enum Foo2::Float64 apple=1.) @enum Fruit apple orange kiwi @test typeof(Fruit) == DataType @@ -138,6 +139,11 @@ end @test reprmime("text/plain", Fruit) == "Enum $(string(Fruit)):\napple = 0\norange = 1\nkiwi = 2" @test reprmime("text/plain", orange) == "orange::$(curmod_prefix)Fruit = 1" +let io = IOBuffer() + ioc = IOContext(io, :compact=>false) + show(io, Fruit) + @test String(take!(io)) == sprint(print, Fruit) +end @enum LogLevel DEBUG INFO WARN ERROR CRITICAL @test DEBUG < CRITICAL