Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The JaroWinkler tests fail on different locales #3583

Closed
abelbraaksma opened this issue Sep 14, 2017 · 6 comments · Fixed by #3627
Closed

The JaroWinkler tests fail on different locales #3583

abelbraaksma opened this issue Sep 14, 2017 · 6 comments · Fixed by #3627

Comments

@abelbraaksma
Copy link
Contributor

abelbraaksma commented Sep 14, 2017

There are four JaroWinkler distance tests. These fail when run on a computer with a different locale.

Repro steps

Run the tests under FSharp.Compiler.Unittests.EditDistance on a German, Dutch or basically any non-US/UK computer and you will get four failing tests, because the output uses ToString internally without taking care of the locale.

Suggested fix: add Culture.InvariantCulture.

Expected behavior

Any unit test should run successfully irrespective of the environments locale settings.

Actual behavior

The following error is thrown:

  String lengths are both 5. Strings differ at index 1.
  Expected: "0.813"
  But was:  "0,813"
  ------------^

   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestActionCommand.Execute(TestExecutionContext context)

(this was one of the findings after starting investigating test coverage, see #3579)

@forki
Copy link
Contributor

forki commented Sep 15, 2017 via email

@abelbraaksma
Copy link
Contributor Author

@forki, I'm planning on doing that :)

@enricosada
Copy link
Contributor

@abelbraaksma there is an helper to require locale us in tests, this is an issue for other tests too

@abelbraaksma
Copy link
Contributor Author

A fix is now in PR #3627.

@KevinRansom
Copy link
Member

@abelbraaksma there is no harm in fixing this.

@abelbraaksma
Copy link
Contributor Author

@KevinRansom, sorry, I think I misunderstood the process. I thought you approved my changes in PR #3627, hence I closed it. Guess that was too early? I see it now mentions "closed with unmerged commits". Sorry, first time PR to this repo... I'll reopen the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants