module demo.ShapesTest # Run with `golo --test demos/shapes` — every *_test.golo in the directory — # or pick this one file. The assertions come from the embedded testing module. import gololang.Testing struct Point = { x, y } augment Point { function describe = |this| -> "(" + this: x() + ", " + this: y() + ")" } function main = |args| { let p = Point(1, 2) assertEqual(p: describe(), "(1, 2)", "a point describes itself") assertEqual(p: x() + p: y(), 3, "fields add up") assertTrue(p: x() < p: y(), "x comes before y") }