From a220d335bae33075baa627b584f3fca3e1917fbc Mon Sep 17 00:00:00 2001 From: Logan Buesching Date: Tue, 2 Jan 2024 14:09:14 -0500 Subject: [PATCH] Fix nullability with nunit --- src/Sage.Engine.Tests/Functions/StringTests.cs | 4 ++-- src/Sage.Engine.Tests/Functions/UtilityTests.cs | 6 +++--- src/Sage.Engine/Runtime/Functions/String.cs | 2 +- src/Sage.Engine/Runtime/Functions/Utility.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Sage.Engine.Tests/Functions/StringTests.cs b/src/Sage.Engine.Tests/Functions/StringTests.cs index 45e6e94..422a1d2 100644 --- a/src/Sage.Engine.Tests/Functions/StringTests.cs +++ b/src/Sage.Engine.Tests/Functions/StringTests.cs @@ -12,7 +12,7 @@ internal class StringTests : FunctionTestBase [TestCase("Hello World", "Hello ", null, "World")] [TestCase("Hello 1World", "Hello ", 1, "World")] [TestCase("1World", null, 1, "World")] - public void TestConcat(string expected, params object[] arguments) + public void TestConcat(string expected, params object?[] arguments) { string actual = this._runtimeContext.CONCAT(arguments); Assert.That(actual, Is.EqualTo(expected)); @@ -25,7 +25,7 @@ public void TestConcat(string expected, params object[] arguments) [TestCase(null, "o", 0)] [TestCase(null, null, 0)] [TestCase("Hello", null, 0)] - public void TestIndexOf(string subject, string search, int expected) + public void TestIndexOf(string? subject, string? search, int expected) { int actual = this._runtimeContext.INDEXOF(subject, search); Assert.That(actual, Is.EqualTo(expected)); diff --git a/src/Sage.Engine.Tests/Functions/UtilityTests.cs b/src/Sage.Engine.Tests/Functions/UtilityTests.cs index e14aab1..09d6d84 100644 --- a/src/Sage.Engine.Tests/Functions/UtilityTests.cs +++ b/src/Sage.Engine.Tests/Functions/UtilityTests.cs @@ -13,7 +13,7 @@ internal class UtilityTests : FunctionTestBase [TestCase("Hello", "Hello")] [TestCase(1, "1")] [TestCase(true, "True")] - public void TestOutputAndV(object data, string expected) + public void TestOutputAndV(object? data, string expected) { this._runtimeContext.OUTPUT(data); Assert.That(this._runtimeContext.PopContext(), Is.EqualTo(expected)); @@ -24,7 +24,7 @@ public void TestOutputAndV(object data, string expected) [TestCase("Hello", "Hello")] [TestCase(1, "1")] [TestCase(true, "True")] - public void TestOutputLine(object data, string expected) + public void TestOutputLine(object? data, string expected) { this._runtimeContext.OUTPUTLINE(data); @@ -36,7 +36,7 @@ public void TestOutputLine(object data, string expected) [TestCase("Hello", "Hello")] [TestCase(1, "1")] [TestCase(true, "True")] - public void TestV(object data, string expected) + public void TestV(object? data, string expected) { string result = this._runtimeContext.V(data); Assert.That(result, Is.EqualTo(expected)); diff --git a/src/Sage.Engine/Runtime/Functions/String.cs b/src/Sage.Engine/Runtime/Functions/String.cs index 4b7251e..da4b6d3 100644 --- a/src/Sage.Engine/Runtime/Functions/String.cs +++ b/src/Sage.Engine/Runtime/Functions/String.cs @@ -44,7 +44,7 @@ public string CONCAT(params object[] strings) /// The string to search /// The string to find /// The position that search exists in subject. If not found, -1 is returned. - public int INDEXOF(object subject, object search) + public int INDEXOF(object? subject, object? search) { if (subject == null || search == null) { diff --git a/src/Sage.Engine/Runtime/Functions/Utility.cs b/src/Sage.Engine/Runtime/Functions/Utility.cs index d568a31..9b9578b 100644 --- a/src/Sage.Engine/Runtime/Functions/Utility.cs +++ b/src/Sage.Engine/Runtime/Functions/Utility.cs @@ -97,7 +97,7 @@ public bool ISNULL(object expression) /// Outputs to where this block appears in the content. /// /// The data to add to the output stream - public void OUTPUT(object data) + public void OUTPUT(object? data) { Output(data); } @@ -106,7 +106,7 @@ public void OUTPUT(object data) /// Outputs to where this block appears in the content, with a newline /// /// The data to add to the output stream - public void OUTPUTLINE(object data) + public void OUTPUTLINE(object? data) { OutputLine(data); }