From e2257e082a8bb343159c797e7c92029b2794d9a7 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 26 Mar 2025 21:55:17 +0100 Subject: [PATCH] Add a regression test --- regression/SliceOutOfRange_test.go | 83 ++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 regression/SliceOutOfRange_test.go diff --git a/regression/SliceOutOfRange_test.go b/regression/SliceOutOfRange_test.go new file mode 100644 index 0000000..82490fe --- /dev/null +++ b/regression/SliceOutOfRange_test.go @@ -0,0 +1,83 @@ +package regression + +import ( + "modify/processor" + "testing" +) + +func TestTalentsMechanicOutOfRange(t *testing.T) { + given := ` + + + + + + + + + + + + + + + + + + + + + + + + + + ` + + actual := ` + + + + + + + + + + + + + + + + + + + + + + + + + + ` + + p := &processor.RegexProcessor{} + result, mods, matches, err := p.ProcessContent(given, `!anyvalue="(?!num)"!anyvalue="(?!num)"!anyvalue="(?!num)"!anyamount="(?!num)"`, "movementspeed=round(movementspeed*1.5, 2) duration=round(duration*2, 2) repairspeed=round(repairspeed*2, 2) durationv=duration") + + if err != nil { + t.Fatalf("Error processing content: %v", err) + } + + if matches != 1 { + t.Errorf("Expected 1 match, got %d", matches) + } + + if mods != 1 { + t.Errorf("Expected 1 modification, got %d", mods) + } + + if result != actual { + t.Errorf("expected %s, got %s", actual, result) + } +}