Revert "Fixed a bug where a misplaced = character could bypass heredoc-style processing. (#2627)" (#2774)

This reverts commit 4ffd081aea.
This commit is contained in:
Cory Miller
2023-08-16 15:03:55 -04:00
committed by GitHub
parent e94e744bed
commit 460d9ae5a8
7 changed files with 1008 additions and 659 deletions

View File

@@ -1,21 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.IO;
using Xunit;
using GitHub.Runner.Sdk;
using System.Linq;
using System.Runtime.CompilerServices;
namespace GitHub.Runner.Common.Tests
{
public enum LineEndingType
{
Native,
Linux = 0x__0A,
Windows = 0x0D0A
}
public static class TestUtil
{
private const string Src = "src";
@@ -52,24 +41,5 @@ namespace GitHub.Runner.Common.Tests
Assert.True(Directory.Exists(testDataDir));
return testDataDir;
}
public static void WriteContent(string path, string content, LineEndingType lineEnding = LineEndingType.Native)
{
WriteContent(path, Enumerable.Repeat(content, 1), lineEnding);
}
public static void WriteContent(string path, IEnumerable<string> content, LineEndingType lineEnding = LineEndingType.Native)
{
string newline = lineEnding switch
{
LineEndingType.Linux => "\n",
LineEndingType.Windows => "\r\n",
_ => Environment.NewLine,
};
var encoding = new UTF8Encoding(true); // Emit BOM
var contentStr = string.Join(newline, content);
File.WriteAllText(path, contentStr, encoding);
}
}
}