mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-04 00:56:31 +02:00
Enable parallel test execution, mark timing-sensitive test as non-parallel, and use Interlocked for TaskId
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
|
||||||
|
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
|
||||||
@@ -76,6 +76,7 @@ public class ConsoleStatementsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
[DoNotParallelize] // timing-sensitive: relies on Thread.Sleep to let the interpreter reach %read_key
|
||||||
public void ReadKeyCanBeInterruptedByStopTest()
|
public void ReadKeyCanBeInterruptedByStopTest()
|
||||||
{
|
{
|
||||||
YesNtInterpreter interpreter = new YesNtInterpreter();
|
YesNtInterpreter interpreter = new YesNtInterpreter();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
using YesNt.Interpreter.Utilities;
|
using YesNt.Interpreter.Utilities;
|
||||||
|
|
||||||
@@ -191,7 +192,7 @@ internal sealed class RuntimeInformation
|
|||||||
IsLocalSearch = false;
|
IsLocalSearch = false;
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
#pragma warning disable S2696 // internalTaskId is a shared counter intentionally incremented by each Reset call
|
#pragma warning disable S2696 // internalTaskId is a shared counter intentionally incremented by each Reset call
|
||||||
TaskId = ++internalTaskId;
|
TaskId = Interlocked.Increment(ref internalTaskId);
|
||||||
#pragma warning restore S2696
|
#pragma warning restore S2696
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user