Skip to content

Commit

Permalink
Fix nullability with nunit
Browse files Browse the repository at this point in the history
  • Loading branch information
lbuesching committed Jan 2, 2024
1 parent 8d68add commit a220d33
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Sage.Engine.Tests/Functions/StringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 17 in src/Sage.Engine.Tests/Functions/StringTests.cs

View workflow job for this annotation

GitHub Actions / build

Argument of type 'object?[]' cannot be used for parameter 'strings' of type 'object[]' in 'string RuntimeContext.CONCAT(params object[] strings)' due to differences in the nullability of reference types.
Assert.That(actual, Is.EqualTo(expected));
Expand All @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions src/Sage.Engine.Tests/Functions/UtilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);

Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/Sage.Engine/Runtime/Functions/String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public string CONCAT(params object[] strings)
/// <param name="subject">The string to search</param>
/// <param name="search">The string to find</param>
/// <returns>The position that search exists in subject. If not found, -1 is returned.</returns>
public int INDEXOF(object subject, object search)
public int INDEXOF(object? subject, object? search)
{
if (subject == null || search == null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sage.Engine/Runtime/Functions/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public bool ISNULL(object expression)
/// Outputs to where this block appears in the content.
/// </summary>
/// <param name="data">The data to add to the output stream</param>
public void OUTPUT(object data)
public void OUTPUT(object? data)
{
Output(data);
}
Expand All @@ -106,7 +106,7 @@ public void OUTPUT(object data)
/// Outputs to where this block appears in the content, with a newline
/// </summary>
/// <param name="data">The data to add to the output stream</param>
public void OUTPUTLINE(object data)
public void OUTPUTLINE(object? data)
{
OutputLine(data);
}
Expand Down

0 comments on commit a220d33

Please sign in to comment.