Skip to content

Inline testing #6

@vladfaust

Description

@vladfaust

I like the idea of unit testing right within a source file (inspired by Zig).

struct Point {
  x, y : Float64
  length() => (this.x ** 2 + this.y ** 2).sqrt()
}

test "Point" {
  test ".length" {
    assert(Point(3, 4).length() =~ *(5, 0.01))
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions