Implement assert has-past
This commit is contained in:
parent
4fee854c4c
commit
e9c9999268
@ -101,7 +101,19 @@ public class AdjudicationQueryScriptHandler(
|
||||
return ScriptResult.Succeed(this);
|
||||
|
||||
case "has-past":
|
||||
// Assert a timeline's past
|
||||
Regex hasPast = new($"^([a-z]+[0-9]+)>([a-z]+[0-9]+)$");
|
||||
Match hpMatch = hasPast.Match(args[1]);
|
||||
if (!hpMatch.Success) return ScriptResult.Fail("Expected format s1>s2", this);
|
||||
|
||||
Season future = new(hpMatch.Groups[1].Value);
|
||||
if (!World.Timelines.Pasts.TryGetValue(future.Key, out Season? actual)) {
|
||||
return ScriptResult.Fail($"No such season \"{future}\"");
|
||||
}
|
||||
|
||||
Season expected = new(hpMatch.Groups[2].Value);
|
||||
if (actual != expected) return ScriptResult.Fail(
|
||||
$"Expected past of {future} to be {expected}, but it was {actual}");
|
||||
return ScriptResult.Succeed(this);
|
||||
|
||||
case "holds":
|
||||
// Assert a unit successfully held
|
||||
|
@ -116,7 +116,6 @@ public class ReplTest
|
||||
[Test]
|
||||
public void AssertSeasonPast()
|
||||
{
|
||||
Assert.Ignore();
|
||||
var repl = StandardRepl();
|
||||
|
||||
repl.ExecuteAll("""
|
||||
|
Loading…
Reference in New Issue
Block a user