Lisette is a New Rust-to-Go Language, So I Built It a Test Library

This morning I dove into a new programming language called Lisette. I saw it from @lmika and had to take a look. It gives you Rust-like syntax but compiles down to Go, and you can import from the Go standard library directly.

It’s early in development, so a lot of things don’t exist yet. They have a roadmap posted with plans for third-party package support, a test runner, bitwise operators, and configurable diagnostics.

So Naturally, I Built a Test Library

Anyone who reads my blog knows I care a lot about testing. So when I saw “implement a test runner” sitting on the roadmap, I did what any reasonable person would do on a Monday morning. I built a testing library for Lisette called LisUnit.

I wanted something that felt familiar if you’ve used Jest or PHPUnit. Test cases are closures that return a result, and assertions work the same way. Here’s what it looks like:

lisunit.Suite.new("math")
  .case("add produces sum", || {
    lisunit.assert_eq_int(add(2, 3), 5)?
    Ok(())
  })
  .case("add is commutative", || {
    lisunit.assert_eq_int(add(2, 3), add(3, 2))?
    Ok(())
  })
  .run()

Define a suite, chain your test cases, run it.

Why Bother?

I don’t know exactly what direction the Lisette team is headed with their own test runner, so this is just a prototype. Building a test library turns out to fun way to try out a new language because you end up touching a lot of language constucts?

I’ll probably keep poking at it as Lisette evolves. Happy Monday.

/ Programming / Golang / Open-source / Testing / Rust