Grails 4.0.1-Spock单元测试用例由于空格而失败 [英] Grails 4.0.1 - Spock unit test cases fail because of spaces

查看:47
本文介绍了Grails 4.0.1-Spock单元测试用例由于空格而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Grails 4.0.1应用程序中使用单元测试来测试i18n格式,但结果却很奇怪.对我来说,应该满足此规范条件,但事实并非如此.

I am testing i18n formatting using unit tests in my Grails 4.0.1 application but seeing strange results. To me, this specs condition should be satisfied, but it is not.

我不认为任何人都有类似的经历可以解释,或者仅仅是一个错误?任何帮助将不胜感激.

I don't suppose anyone has had a similar experience that can be explained, or maybe it's simply a bug? Any help would be appreciated.

推荐答案

只是一个想法:

您能否遍历期望值和实际值并将字符一个接一个地转换为ASCII,以便您可能会看到差异

Can you iterate over both expected and actual values and convert the characters one by one to the ascii so that you'll probably see the difference

for( c in ​'123 456,78 $') {  
  println "$c   ${(int)c}"
}

这篇关于Grails 4.0.1-Spock单元测试用例由于空格而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆