Add another test
This commit is contained in:
43
main_test.go
43
main_test.go
@@ -1057,3 +1057,46 @@ func TestStringVsNumericPriority(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRegression(t *testing.T) {
|
||||||
|
input := `
|
||||||
|
<verbProperties>
|
||||||
|
<verbClass>Verb_CastAbility</verbClass>
|
||||||
|
<warmupTime>0</warmupTime>
|
||||||
|
<range>120</range>
|
||||||
|
<drawAimPie>true</drawAimPie>
|
||||||
|
<requireLineOfSight>true</requireLineOfSight>
|
||||||
|
<targetParams>
|
||||||
|
<canTargetSelf>false</canTargetSelf>
|
||||||
|
<canTargetBuildings>false</canTargetBuildings>
|
||||||
|
<canTargetPawns>false</canTargetPawns>
|
||||||
|
<canTargetLocations>true</canTargetLocations>
|
||||||
|
</targetParams>
|
||||||
|
`
|
||||||
|
expected := `
|
||||||
|
<verbProperties>
|
||||||
|
<verbClass>Verb_CastAbility</verbClass>
|
||||||
|
<warmupTime>0</warmupTime>
|
||||||
|
<range>120</range>
|
||||||
|
<drawAimPie>true</drawAimPie>
|
||||||
|
<requireLineOfSight>false</requireLineOfSight>
|
||||||
|
<targetParams>
|
||||||
|
<canTargetSelf>false</canTargetSelf>
|
||||||
|
<canTargetBuildings>false</canTargetBuildings>
|
||||||
|
<canTargetPawns>false</canTargetPawns>
|
||||||
|
<canTargetLocations>true</canTargetLocations>
|
||||||
|
</targetParams>
|
||||||
|
`
|
||||||
|
|
||||||
|
pattern := regexp.MustCompile("(?s)requireLineOfSight>(true)")
|
||||||
|
|
||||||
|
luaExpr := buildLuaScript("s1 = 'false'")
|
||||||
|
result, _, _, err := process(string(input), pattern, luaExpr, "Abilities.xml", "s1 = 'false'")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Process function failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if result != expected {
|
||||||
|
t.Errorf("Expected output: %s, got: %s", expected, result)
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user