tests: the map-scoped tables' example and rejected fixtures
examples/lang/permap (two maps, a chunked table with a negative, a positive and a missing chunk, constants and fn by name, a nested list, a cross-row @Ref, a reload shrinking in place, a bad file's file:line:col; built under arena strict with an @On frame root), --check fixtures for a wrong field, a wrong type, an unknown constant and a dangling cross-row @Ref, @Ref(PerMap) on an int, as PREFIX, and a @Unit warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2f4860ae71
commit
5a751434ac
17 changed files with 181 additions and 0 deletions
5
examples/rejected/permap_maps/maps/m1/props.lres
Normal file
5
examples/rejected/permap_maps/maps/m1/props.lres
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
tent { model: MDL_TENT, home: "fire" }
|
||||
lamp { model: 1, colour: 3 }
|
||||
crate { model: "big" }
|
||||
bench { model: MDL_BENCH }
|
||||
sign { model: 2, scale: 0.5, home: "nowhere" }
|
||||
1
examples/rejected/permap_maps/maps/m1/spots.lres
Normal file
1
examples/rejected/permap_maps/maps/m1/spots.lres
Normal file
|
|
@ -0,0 +1 @@
|
|||
fire { x: 1.0 }
|
||||
2
examples/rejected/permap_maps/package.ludic
Normal file
2
examples/rejected/permap_maps/package.ludic
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# permap_maps.ludic's maps, each file with one thing `ludicc --check` must refuse
|
||||
maps "maps"
|
||||
19
examples/rejected/permap_maps/permap_maps.ludic
Normal file
19
examples/rejected/permap_maps/permap_maps.ludic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# permap_maps.ludic - `ludicc --check` reads every map directory and checks its tables against their
|
||||
# records. maps/m1 holds four mistakes, each refused at its file, line and column: a field the
|
||||
# record lacks, a value of the wrong type, a constant nobody declared, and a key naming no row.
|
||||
program PerMapMaps {
|
||||
numbers float
|
||||
const MDL_TENT: int = 7
|
||||
property Spot { key: string = "", x: float = 0.0 }
|
||||
@PerMap registry Spots of Spot from "spots.lres"
|
||||
property PropRow {
|
||||
key: string = ""
|
||||
model: int = 0
|
||||
scale: float = 1.0
|
||||
@Ref(Spots) home: string = ""
|
||||
}
|
||||
@PerMap @ByKey registry Props of PropRow from "props.lres"
|
||||
entry (props: mut Props) {
|
||||
print(`{props_load(props, "m1")}`)
|
||||
}
|
||||
}
|
||||
7
examples/rejected/permap_prefix.ludic
Normal file
7
examples/rejected/permap_prefix.ludic
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# permap_prefix.ludic - a @PerMap registry's keys are not known when the program compiles, so it has
|
||||
# no `as PREFIX` and no constants
|
||||
program PerMapPrefix {
|
||||
property Spot { key: string = "" }
|
||||
@PerMap registry Spots of Spot as SPOT from "spots.lres"
|
||||
entry { print(1) }
|
||||
}
|
||||
12
examples/rejected/permap_ref_int.ludic
Normal file
12
examples/rejected/permap_ref_int.ludic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# permap_ref_int.ludic - an @Ref into a @PerMap registry names a row by its key: a map's rows have
|
||||
# no index a program could hold, so the field is a string
|
||||
program PerMapRefInt {
|
||||
property Spot { key: string = "" }
|
||||
@PerMap registry Spots of Spot from "spots.lres"
|
||||
property Npc {
|
||||
key: string = ""
|
||||
@Ref(Spots) home: int = 0
|
||||
}
|
||||
@PerMap registry Npcs of Npc from "npcs.lres"
|
||||
entry { print(1) }
|
||||
}
|
||||
6
examples/rejected/permap_unit.ludic
Normal file
6
examples/rejected/permap_unit.ludic
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# permap_unit.ludic - @Unit's spellings are ASCII, one per unit: "°" builds, with a warning naming
|
||||
# "deg" (it lives among the rejected examples for the warning it draws, not for an error)
|
||||
program PerMapUnit {
|
||||
property Sign { @Unit("°") yaw: float = 0.0, @Unit("m/s") speed: float = 0.0 }
|
||||
entry { print(1) }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue