edn-provide.flan reads assets/edn/tileset.edn through a struct derived from it, and its first five lines are edn-read.flan's first five character for character. Two readers over one file agreeing is what says the derived one is right; either alone could be self-consistently wrong. The pair memberships are the derivation deciding in public: the set became a (Map [2 i64] bool), so [3 4] is a key and [9 9] is not, where a version that made it 108 loose integers would have compiled and answered differently on all four. A tuning file beside it covers the rest of the matrix — a string, an integer, a float, a boolean, a vector summed rather than counted, and a map inside a map read two field loads deep — and then drift: the struct was derived from a file with :speed and without :level, and the bytes read carry the opposite. Both are named, and the read carries on. The refusals write their own data file, because the data file is the test. Each is asserted on the position it names, not on the fact of failing, and one of them checks a line and column into a file the compiler is not reading — which is the whole of what compile-error was added for. Two things the tests caught. Load extends the ambient macro set rather than replacing it, so a package reached twice handed its declarations over twice and the module refused them as a redefinition; Macro.compile dedupes by name, which is the rule macro_union already applies a level up. And `where` held a line and a column at once, which the prelude's note over append-i64 says cannot be done: i64->bytes renders into one shared static buffer, and both numbers read as the second one.
12 lines
361 B
Clojure
12 lines
361 B
Clojure
;; A tuning file with one of each shape defedn derives, so that the struct it
|
|
;; produces exercises every arm: a string, an integer, a float, a boolean, a
|
|
;; homogeneous vector, a nested map, and a nested map inside that one.
|
|
{:name "goblin"
|
|
:hp 12
|
|
:speed 1.5
|
|
:boss? false
|
|
:drops [3 1 4 1 5]
|
|
:hitbox {:w 16
|
|
:h 24
|
|
:offset {:x -2 :y 0}}}
|