Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expect #15

Open
fponticelli opened this issue Aug 28, 2015 · 1 comment
Open

Add expect #15

fponticelli opened this issue Aug 28, 2015 · 1 comment

Comments

@fponticelli
Copy link
Collaborator

Should take something like this:

expect(x + y == 3);

And transform into:

var t1 = x,
    t2 = y
    t3 = x + y;
Assert.isTrue(t3 == 3, 'expected `x <$t1> + y <$t2> == 3 <$t3>`');

Not sure if expect should be part of Assert or specific to utest tests.

@khalyomede
Copy link

What about something like:

import haxe.Exception;
import utest.Expect;
import utest.Assert;
import utest.Test;

class FooTest extends Test {
  function testEquals() {
    Expect.value(1).toBeEqualTo(1);
    Assert.equals(1, 1);
  }

  function testRaises() {
    Expect.value(() -> throw new Exception("foo")).toRaise(Exception);
    Assert.raises(() -> throw new Exception("foo"), Exception);
  }

  function testTrue() {
    Expect.value(true).toBeTrue();
    Assert.isTrue(true, true);
  }

  // ...
}

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants