Sha256: 06cccb9941277f2801ef91ce50637dc3f40e160ff1e8319be4bb450445265767
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
package asunit.framework { import asunit.asserts.*; import asunit.errors.AssertionFailedError; public class AssertThrowsTest { [Test] public function throwingExpectedErrorShouldPass():void { assertThrows(ArgumentError, function():void { throw new ArgumentError(); } ); } [Test] public function throwingUnexpectedErrorShouldFailWithMessage():void { try { assertThrows(ArgumentError, function():void { throw new Error("wrong error type"); } ); } catch (e:AssertionFailedError) { assertEquals("expected error type:<ArgumentError> but was:<Error>", e.message) return; } fail('failed assertThrows() should have thrown AssertionFailedError'); } /** * Captures a bug in original assertThrows implementation * where the message when nothing was thrown said "but was:<AssertionFailedError>". */ [Test] public function throwingNoErrorShouldFailWithMessage():void { try { assertThrows(ArgumentError, function():void { } ); } catch (e:AssertionFailedError) { assertEquals("expected error type:<ArgumentError> but none was thrown.", e.message) return; } fail('failed assertThrows() should have thrown AssertionFailedError'); } } }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
asunit4-4.2.3.pre | test/asunit/framework/AssertThrowsTest.as |
asunit4-4.2.2.pre | test/asunit/framework/AssertThrowsTest.as |
asunit4-4.2.1.pre | test/asunit/framework/AssertThrowsTest.as |