turbo-editors/turbo-golopublic Fork 0
b2b07ec0fe8e8d54362f3a1a6f1b089e9198ebd8
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.

📦 Turbo Golo d710c1b · on b2b07ec0fe8e8d54362f3a1a6f1b089e9198ebd8 · k33g · yesterday
shapes_test.golo · 18 lines · 543 BText Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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")
}