turbo-editors/turbo-golopublic Fork 0
d710c1bba73df5d362f9462d12805186996ad134
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-golo.git
git clone ssh://git@rickub.com/turbo-editors/turbo-golo.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

shapes_test.golo · 18 lines · 543 BText Blame HistoryRaw
📦 Turbo Golo d710c1b k33g 23h ago1module 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.
5import gololang.Testing
6
7struct Point = { x, y }
8
9augment Point {
10 function describe = |this| -> "(" + this: x() + ", " + this: y() + ")"
11}
12
13function 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}