views:

89

answers:

3

The title says it all. The following code produces a failed test, not a passing test (as I would expect):

[Test(expects="Error")]
public function someTest():void {
    throw Error("this test doesn't pass");
}
+1  A: 

Make sure you're linking against the release SWC of FlexUnit, or if you're compiling it yourself, make sure you're using --keep-as3-metadata+=Test in the "additional compiler options" box in project properties.

Sophistifunk
I'm (pretty) sure I've got the `--keep-as3-metadata+=Test` because, if I take out the `[Test]` metadata, this test doesn't run (ie, my other tests run but this one does not).
David Wolever
A: 

I think the problem may have been that I was using an older version of FlexUnit4. I just upgraded (to 4.0 RC1) and it seems to be working now.

David Wolever
+1  A: 

In older versions it was [Test(expected='')]

In newer versions we support both expected and expects as this was confusing for many