No description
Find a file
Avahe Kellenberger 17bd3a0f79 v0.1.2
2022-09-11 12:03:01 -04:00
src Fixed edge case causing indentation issues. 2022-09-11 12:01:38 -04:00
tests Added examples to README 2022-09-01 15:59:19 -04:00
.gitignore Initial commit. 2022-03-21 19:16:55 -04:00
config.nims Initial commit. 2022-03-21 19:16:55 -04:00
nimtest.nimble v0.1.2 2022-09-11 12:03:01 -04:00
README.md Added examples to README 2022-09-01 15:59:19 -04:00

nimtest

A simple testing framework for Nim.

This is used mostly for my personal projects. If you're looking for something more "official", take a look at Testament.

Examples

See the tests directory for more comprehensive tests.

describe "assertEquals":

  type Foo = ref object
    x: int

  it "works properly with nillable objects":
    var f: Foo = nil
    assertEquals(f, nil)

    f = Foo(x: 5)
    assertRaises:
      assertEquals(f, nil)

describe "Test with hooks":
  var
    lock: Lock
    a: int

  beforeAll:
    initLock(lock)

  beforeEach:
    a = 5
    acquire(lock)

  afterEach:
    release(lock)

  afterAll:
    deinitLock(lock)

  it "tests something":
    doAssert(a == 5)