Skip to content

Commit e058dd7

Browse files
committed
Revert "Make dotnet-watch tests TFM agnostic (#44604)"
This reverts commit 2d9a8cc.
1 parent afb8b88 commit e058dd7

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ class AppUpdateHandler
249249

250250
await App.AssertOutputLineStartsWith("Updated");
251251

252-
AssertEx.ContainsRegex(
253-
@"dotnet watch ⚠ \[WatchHotReloadApp \(net\d+\.\d+\)\] Expected to find a static method 'ClearCache' or 'UpdateApplication' on type 'AppUpdateHandler, WatchHotReloadApp, Version=1\.0\.0\.0, Culture=neutral, PublicKeyToken=null' but neither exists.",
252+
AssertEx.Contains(
253+
"dotnet watch ⚠ [WatchHotReloadApp (net9.0)] Expected to find a static method 'ClearCache' or 'UpdateApplication' on type 'AppUpdateHandler, WatchHotReloadApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' but neither exists.",
254254
App.Process.Output);
255255
}
256256

@@ -290,13 +290,13 @@ class AppUpdateHandler
290290

291291
await App.AssertOutputLineStartsWith("Updated");
292292

293-
AssertEx.ContainsRegex(
294-
@"dotnet watch ⚠ \[WatchHotReloadApp \(net\d+\.\d+\)\] Exception from 'System.Action`1\[System.Type\[\]\]': System.InvalidOperationException: Bug!",
293+
AssertEx.Contains(
294+
"dotnet watch ⚠ [WatchHotReloadApp (net9.0)] Exception from 'System.Action`1[System.Type[]]': System.InvalidOperationException: Bug!",
295295
App.Process.Output);
296296

297297
if (verbose)
298298
{
299-
AssertEx.ContainsRegex(@"dotnet watch 🕵️ \[WatchHotReloadApp \(net\d+\.\d+\)\] Deltas applied.", App.Process.Output);
299+
AssertEx.Contains("dotnet watch 🕵️ [WatchHotReloadApp (net9.0)] Deltas applied.", App.Process.Output);
300300
}
301301
else
302302
{

test/dotnet-watch.Tests/Utilities/AssertEx.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#nullable disable
55

66
using System.Collections;
7-
using System.Text.RegularExpressions;
87
using Xunit.Sdk;
98

109
namespace Microsoft.DotNet.Watch.UnitTests
@@ -247,26 +246,6 @@ public static void Contains(string expected, IEnumerable<string> items)
247246
Fail(message.ToString());
248247
}
249248

250-
public static void ContainsRegex(string pattern, IEnumerable<string> items)
251-
{
252-
var regex = new Regex(pattern, RegexOptions.Compiled);
253-
254-
if (items.Any(item => regex.IsMatch(item)))
255-
{
256-
return;
257-
}
258-
259-
var message = new StringBuilder();
260-
message.AppendLine($"Pattern '{pattern}' not found in:");
261-
262-
foreach (var item in items)
263-
{
264-
message.AppendLine($"'{item}'");
265-
}
266-
267-
Fail(message.ToString());
268-
}
269-
270249
public static void DoesNotContain(string expected, IEnumerable<string> items)
271250
=> Assert.DoesNotContain(expected, items);
272251
}

0 commit comments

Comments
 (0)