atrium icon indicating copy to clipboard operation
atrium copied to clipboard

number formatting should use Locale of translator

Open robstoll opened this issue 6 years ago • 0 comments

Affected Version: 0.8.0 API (fluent-en_GB, cc or cc-infix): core level Platform (jvm, js, android): all Extension (none, kotlin 1.3, jdk8): none

How to reproduce the problem

Consider the following code snippet

expect(9.99f).toBeWithErrorTolerance(10.0f, 0.01f)

Will result in an error stating:

expect: 9.99        (kotlin.Float <1234789>)
◆ to be (error ± 0.01): 10.0        (kotlin.Float <1234789>)
    » failure might be due to using kotlin.Float, see exact check on the next line
    » exact check is |9.989999771118164 - 10.0| = 0.010000228881835938 ≤ 0.009999999776482582

Describe the bug

The formatting of the numbers should be dependent on the Locale specified via reporter. Maybe I am wrong but I think it currently does not take it into account.

Expected behaviour

Takes the Locale specified for the translator and not the default locale (the default reporter uses the default locale and thus this bug was not detected so far and probably does not cause problems).

robstoll avatar Oct 15 '19 05:10 robstoll