File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ const BATTERIES_DEFAULTS = (
3939 getproperties= true , constructorof= true ,
4040)
4141
42+ const ALLOWED_KW = keys (BATTERIES_DEFAULTS)
43+
4244"""
4345
4446 @batteries T [options]
6163"""
6264macro batteries (T, kw... )
6365 nt = parse_all_macro_kw (kw)
64- for pname in propertynames (nt)
66+ for ( pname, val) in pairs (nt)
6567 if ! (pname in propertynames (BATTERIES_DEFAULTS))
6668 error ("""
6769 Unsupported keyword.
6870 Offending Keyword: $pname
6971 allowed: $ALLOWED_KW
70- Got: $kw
72+ Got: $nt
73+ """ )
74+ end
75+ if ! (val isa Bool)
76+ error ("""
77+ All options must be literally `true` or `false`.
78+ Got: $nt
79+ Offending Keyword: $pname
7180 """ )
7281 end
7382 end
Original file line number Diff line number Diff line change @@ -62,4 +62,9 @@ struct Empty2 end
6262 @test Empty1 () != = Empty2 ()
6363 @test Empty1 () != Empty2 ()
6464 @test hash (Empty1 ()) != hash (Empty2 ())
65+
66+ struct SErrors;a;b;c;end
67+ @test_throws Exception @macroexpand @batteries SErrors kwconstructor= " true"
68+ @test_throws Exception @macroexpand @batteries SErrors nonsense= true
69+ @macroexpand @batteries SErrors kwconstructor= true
6570end
You can’t perform that action at this time.
0 commit comments