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

Locale problem raised by hard coded exception message in UnitTests #7

Closed
nbsn2 opened this issue Oct 10, 2017 · 3 comments
Closed

Locale problem raised by hard coded exception message in UnitTests #7

nbsn2 opened this issue Oct 10, 2017 · 3 comments

Comments

@nbsn2
Copy link

nbsn2 commented Oct 10, 2017

https://stackoverflow.com/questions/209133/exception-messages-in-english

Though not a big problem if restricted to Appveyor environment. May cause trouble to local development.

@smaillet
Copy link
Member

Can you elaborate on the exact problem here? The test code validates some exception messages explicitly generated by Llvm.NET library (not MScorlib or other framework libs) the reason is to ensure the correct handling of errors given invalid input. Since Most such cases ultimately generate an ArgumentException the tests need to delve into the exception a bit to verify that the correct information is provided to help a developer fix their usage of the API.

At this point in time Llvm.NET itself uses hardcoded strings and not Locale specific resources for the exception messages.

@nbsn2
Copy link
Author

nbsn2 commented Oct 12, 2017

Tested in français

France


Failed   MultiContextLinkTest
Error Message:
   Assert.AreEqual failed. Expected:<Linking modules from different contexts is not allowed
Parameter name: otherModule>. Actual:<Linking modules from different contexts is not allowed
Nom du paramètre?: otherModule>. Could not verify the exception message.
Stack Trace:
   à Llvm.NET.NativeModule.Link(NativeModule otherModule) dans C:\Llvm.NET-master\src\Llvm.NET\Module.cs:ligne 301
   à Llvm.NET.Tests.ModuleTests.MultiContextLinkTest() dans C:\Llvm.NET-master\src\Llvm.NETTests\ModuleTests.cs:ligne 145
Total tests: 78. Passed: 72. Failed: 1. Skipped: 5.
Test Run Failed.
Test execution time: 6,3781 Seconds
One or more tests failed - Build should fail
Au caractère C:\Llvm.NET-master\Invoke-UnitTests.ps1:56 : 5
+     throw "One or more tests failed - Build should fail"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (One or more tes...ild should fail:String) [], RuntimeException
    + FullyQualifiedErrorId : One or more tests failed - Build should fail

Tested in 日本語

Failed   MultiContextLinkTest
Error Message:
   Assert.AreEqual failed. Expected:<Linking modules from different contexts is not allowed
Parameter name: otherModule>. Actual:<Linking modules from different contexts is not allowed
パラメーター名:otherModule>. Could not verify the exception message.
Stack Trace:
   場所 Llvm.NET.NativeModule.Link(NativeModule otherModule) 場所 C:\Llvm.NET-master\src\Llvm.NET\Module.cs:行 296
   場所 Llvm.NET.Tests.ModuleTests.MultiContextLinkTest() 場所 C:\Llvm.NET-master\src\Llvm.NETTests\ModuleTests.cs:行 145
Total tests: 78. Passed: 72. Failed: 1. Skipped: 5.
Test Run Failed.
Test execution time: 6.6396 Seconds
One or more tests failed - Build should fail
At C:\Llvm.NET-master\Invoke-UnitTests.ps1:56 char:5
+     throw "One or more tests failed - Build should fail"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (One or more tes...ild should fail:String) [], RuntimeException
    + FullyQualifiedErrorId : One or more tests failed - Build should fail

@smaillet
Copy link
Member

Ah, thanks for the clarification. I missed that would be checking strings owned by the platform. That's something that should be fixed in the tests.

smaillet added a commit to smaillet/Llvm.NET that referenced this issue Oct 13, 2017
- This change simply alters the test for the exception message to verify the part provided by the Llvm.NET library itself, ignoring the trailing part provided by the  BCL, which is subject to Locale differences.
- Appveyor.yml is set to run test in a second locale to help catch any future issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants