FlexUnit4 的问题

发布于 2024-09-06 17:48:17 字数 378 浏览 1 评论 0原文

我有点困惑,因为 FlexUnith 4 的行为。当我在 try-catch 主体中使用 failed() 时,失败方法被忽略。

[Test]
        public function extend():void
        {   
            try {
                fail("This should fail");                   
            } catch(er:Error) {}

        }

我想这个应该失败,因为没有办法解决它,但它成功并变成绿色。我是什么做错了吗?当我将fail()放在try-catch块之前时,它会失败,因为它应该使用Flash builder 4。

I"m a bit confused because FlexUnith 4's behavior. When I use fail() in try-catch body fail method is just ignored.

[Test]
        public function extend():void
        {   
            try {
                fail("This should fail");                   
            } catch(er:Error) {}

        }

I suppose this one should fail as there is no way around it, but it succeeds and turns green. Whatam I doing wrong? When i put fail() before try-catch block it fails as it is suposed to. BTW using Flash builder 4.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请别遗忘我 2024-09-13 17:48:17

向框架发出断言信号的方式是通过异常。 fail 也使用异常发送失败信号。那,以及 Error 是所有异常的基类这一事实意味着没有异常会到达框架(您的 try/catch 块捕获所有异常),这意味着测试没有失败。

The way assertions are signaled to the framework is through exceptions. fail sends the failure signal using an exception too. That, and the fact that Error is the base class for all exceptions means that no exception will ever reach the framework (your try/catch block catches all excpetions), which means that the test didn't fail.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文