Detection for heredoc (#2738)

This commit is contained in:
Cory Miller
2023-08-08 11:12:42 -04:00
committed by GitHub
parent 9c8abf2a6e
commit 0be495a2f9
2 changed files with 3 additions and 3 deletions

View File

@@ -343,7 +343,7 @@ namespace GitHub.Runner.Worker
{
throw new Exception($"Invalid format '{line}'. Name must not be empty and delimiter must not be empty");
}
key = split[0];
key = split[0].Trim().TrimEnd('=');
var delimiter = split[1];
var startIndex = index; // Start index of the value (inclusive)
var endIndex = index; // End index of the value (exclusive)

View File

@@ -250,13 +250,13 @@ namespace GitHub.Runner.Common.Tests.Worker
TestUtil.WriteContent(stateFile, content);
_fileCmdExtension.ProcessCommand(_executionContext.Object, stateFile, null);
Assert.Equal(0, _issues.Count);
Assert.Equal(4, _store.Count);
Assert.Equal(7, _store.Count);
Assert.Equal($"hello{BREAK}{BREAK}three{BREAK}", _store["MY_KEY_1"]);
Assert.Equal($"hello=two", _store["MY_KEY_2"]);
Assert.Equal($" EOF", _store["MY_KEY_3"]);
Assert.Equal($"EOF EOF", _store["MY_KEY_4"]);
Assert.Equal($"abc << def", _store["MY_KEY_5"]);
Assert.Equal($"white space test", _store["MY_KEY_6="]);
Assert.Equal($"white space test", _store["MY_KEY_6"]);
Assert.Equal($"abc", _store["MY_KEY_7"]);
}
}