convert enumerators written with a value
(wire-varint 0) is a pair, and both the writer and map-fields only expected a name: the writer passed it out unconverted, and a macro mapping over the enum was handed the pair. Fixes #46.
This commit is contained in:
@@ -200,6 +200,16 @@ compiles."
|
||||
(emits? "(pub enum color (red green blue))" "enum color"))
|
||||
(test-assert "with its values"
|
||||
(emits? "(pub enum color (red green blue))" "red"))
|
||||
;; A value made the enumerator a pair, which went out unconverted
|
||||
(test-assert "explicit values"
|
||||
(emits? "(pub enum wire ((wire-varint 0) (wire-fixed64 1)))"
|
||||
"wire_varint = 0, wire_fixed64 = 1"))
|
||||
(test-assert "a value is an expression"
|
||||
(emits? "(enum wire ((wire-last (+ WIRE-BASE 1))))"
|
||||
"wire_last = WIRE_BASE + 1"))
|
||||
(test-assert "and an anonymous enum takes them too"
|
||||
(emits? "(fn f () void (var e (enum ((up-one 1) down)) up-one))"
|
||||
"up_one = 1, down"))
|
||||
(test-assert "and a non-pub enum still is too"
|
||||
(emits? "(enum color (red green blue))" "enum color"))
|
||||
;; Naming an enum as a type, rather than defining it, had no
|
||||
|
||||
Reference in New Issue
Block a user