| 📦 Turbo Golo d710c1b k33g yesterday | 1 | module demo.ShapesTest |
| 2 | |
| 3 | # Run with `golo --test demos/shapes` — every *_test.golo in the directory — |
| 4 | # or pick this one file. The assertions come from the embedded testing module. |
| 5 | import gololang.Testing |
| 6 | |
| 7 | struct Point = { x, y } |
| 8 | |
| 9 | augment Point { |
| 10 | function describe = |this| -> "(" + this: x() + ", " + this: y() + ")" |
| 11 | } |
| 12 | |
| 13 | function main = |args| { |
| 14 | let p = Point(1, 2) |
| 15 | assertEqual(p: describe(), "(1, 2)", "a point describes itself") |
| 16 | assertEqual(p: x() + p: y(), 3, "fields add up") |
| 17 | assertTrue(p: x() < p: y(), "x comes before y") |
| 18 | } |