提交 2ddb8311 编写于 作者: J Julien Couvreur 提交者: GitHub

Update diagnostic usage for langversion in C# (#17231)

上级 f2c44e9f
......@@ -1232,7 +1232,7 @@ internal class CSharpResources {
}
/// <summary>
/// Looks up a localized string similar to Invalid option &apos;{0}&apos; for /langversion; must be ISO-1, ISO-2, Default or an integer in range 1 to 6..
/// Looks up a localized string similar to Invalid option &apos;{0}&apos; for /langversion; must be ISO-1, ISO-2, Default or an integer in range 1 to 7..
/// </summary>
internal static string ERR_BadCompatMode {
get {
......
......@@ -2687,7 +2687,7 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep
<value>This warning occurs if the assembly attributes AssemblyKeyFileAttribute or AssemblyKeyNameAttribute found in source conflict with the /keyfile or /keycontainer command line option or key file name or key container specified in the Project Properties.</value>
</data>
<data name="ERR_BadCompatMode" xml:space="preserve">
<value>Invalid option '{0}' for /langversion; must be ISO-1, ISO-2, Default or an integer in range 1 to 6.</value>
<value>Invalid option '{0}' for /langversion; must be ISO-1, ISO-2, Default or an integer in range 1 to 7.</value>
</data>
<data name="ERR_DelegateOnConditional" xml:space="preserve">
<value>Cannot create delegate with '{0}' because it or a method it overrides has a Conditional attribute</value>
......
......@@ -1322,6 +1322,14 @@ public void LangVersion()
Assert.Equal(defaultVersion, parsedArgs.ParseOptions.LanguageVersion);
}
[Fact]
public void RememberToUpdateDiagnosticsWhenUpdatingLangVersion()
{
// When new language versions are added, this test will fail. Remember to update the diagnostics message (ERR_BadCompatMode).
Assert.Equal(LanguageVersion.CSharp7, LanguageVersion.Latest.MapSpecifiedToEffectiveVersion());
Assert.Equal(LanguageVersion.CSharp7, LanguageVersion.Default.MapSpecifiedToEffectiveVersion());
}
[Fact]
[WorkItem(546961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546961")]
public void Define()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册