diff --git a/LocalisationAnalyser.Tests/CodeFixes/LocaliseClassStringCodeFixTests.cs b/LocalisationAnalyser.Tests/CodeFixes/LocaliseClassStringCodeFixTests.cs index 0f3710f..ff4047b 100644 --- a/LocalisationAnalyser.Tests/CodeFixes/LocaliseClassStringCodeFixTests.cs +++ b/LocalisationAnalyser.Tests/CodeFixes/LocaliseClassStringCodeFixTests.cs @@ -14,6 +14,8 @@ public class LocaliseClassStringCodeFixTests : AbstractLocaliseStringCodeFixTest [Theory] [InlineData("BasicString")] [InlineData("VerbatimString")] + [InlineData("InterpolatedString")] + [InlineData("InterpolatedStringWithQuotes")] public async Task Check(string name) => await RunTest(name); protected override Task Verify((string filename, string content)[] sources, (string filename, string content)[] fixedSources) diff --git a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Localisation/ProgramStrings.txt b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Localisation/ProgramStrings.txt index d9164bd..3fd96bd 100644 --- a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Localisation/ProgramStrings.txt +++ b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Localisation/ProgramStrings.txt @@ -7,10 +7,10 @@ namespace TestProject.Localisation { public static class ProgramStrings { - private const string prefix = @"TestProject.Localisation.ProgramStrings"; + private const string prefix = @"TestProject.Localisation.Program"; /// - /// "this is an interpolated string (i = {0})"" + /// "this is an interpolated string (i = {0})" /// public static LocalisableString Thisisanin(int i) => new TranslatableString(getKey(@"thisisanin"), @"this is an interpolated string (i = {0})", i); diff --git a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Program.txt b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Program.txt index cf822f8..4ba2731 100644 --- a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Program.txt +++ b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedString/Fixed/Program.txt @@ -6,7 +6,8 @@ namespace Test { static void Main() { - string x = ProgramStrings.Thisisanin; + int i = 5; + string x = ProgramStrings.Thisisanin(i); } } } \ No newline at end of file diff --git a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Fixed/Localisation/ProgramStrings.txt b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Fixed/Localisation/ProgramStrings.txt new file mode 100644 index 0000000..d93390f --- /dev/null +++ b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Fixed/Localisation/ProgramStrings.txt @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace TestProject.Localisation +{ + public static class ProgramStrings + { + private const string prefix = @"TestProject.Localisation.Program"; + + /// + /// "Folder "{0}" not available in the target osu!stable installation to import." + /// + public static LocalisableString Foldernota(string fullPath) => new TranslatableString(getKey(@"foldernota"), @"Folder ""{0}"" not available in the target osu!stable installation to import.", fullPath); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Fixed/Program.txt b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Fixed/Program.txt new file mode 100644 index 0000000..7a505bb --- /dev/null +++ b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Fixed/Program.txt @@ -0,0 +1,13 @@ +using TestProject.Localisation; + +namespace Test +{ + class Program + { + static void Main() + { + string fullPath = string.Empty; + string x = ProgramStrings.Foldernota(fullPath); + } + } +} \ No newline at end of file diff --git a/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Sources/Program.txt b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Sources/Program.txt new file mode 100644 index 0000000..1a5ffdd --- /dev/null +++ b/LocalisationAnalyser.Tests/Resources/CodeFixes/InterpolatedStringWithQuotes/Sources/Program.txt @@ -0,0 +1,11 @@ +namespace Test +{ + class Program + { + static void Main() + { + string fullPath = string.Empty; + string x = [|$"Folder \"{fullPath}\" not available in the target osu!stable installation to import."|]; + } + } +} \ No newline at end of file