Files
RobustToolbox/Robust.UnitTesting/Shared/Localization/LoadLocalizationTest.cs
T
9240c94e59 Write Errors when a duplicate localization key is found. (#4885)
* Update Linguini to v0.8.1

* Add tests and verify desired behavior has been reached.

* Remove duplicate messages.

* Minor fix to message output. Add Wrapper for Fluent errors.

* Restart the test pipeline.

* Restart the test pipeline.

* Make so test don't do an early bailout.

* Ensure all errors get written rather than bailing on first.

* Fix text breakage.

* Remove obsolete // TODO LINGUINI

* line wrapping conventions

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
2024-06-05 15:23:41 +10:00

44 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using NUnit.Framework;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
namespace Robust.UnitTesting.Shared.Localization;
[TestFixture]
public sealed class LoadLocalizationTest : RobustUnitTest
{
private const string DuplicateTerm = @"
term1 = 1
term1 = 2
";
protected override void OverrideIoC()
{
base.OverrideIoC();
IoCManager.Register<ILogManager, SpyLogManager>(overwrite: true);
}
[Test]
public void TestLoadLocalization()
{
var res = IoCManager.Resolve<IResourceManagerInternal>();
res.MountString("/Locale/en-US/a.ftl", DuplicateTerm);
var loc = IoCManager.Resolve<ILocalizationManager>();
var spyLog = (SpyLogManager) IoCManager.Resolve<ILogManager>();
var culture = new CultureInfo("en-US", false);
var x = spyLog.CountError;
loc.LoadCulture(culture);
Assert.That(spyLog.CountError, NUnit.Framework.Is.GreaterThan(x));
}
}