Implement loading lua from separate files via @
This commit is contained in:
@@ -252,7 +252,7 @@ func TestDecimalValues(t *testing.T) {
|
||||
`
|
||||
|
||||
regex := regexp.MustCompile(`(?s)<value>([0-9.]+)</value>.*?<multiplier>([0-9.]+)</multiplier>`)
|
||||
luaExpr := BuildLuaScript("v1 = v1 * v2")
|
||||
luaExpr := BuildLuaScript("v1 = v1 * v2", "")
|
||||
|
||||
result, _, _, err := APIAdaptor(content, regex.String(), luaExpr)
|
||||
assert.NoError(t, err, "Error processing content: %v", err)
|
||||
@@ -280,7 +280,7 @@ func TestLuaMathFunctions(t *testing.T) {
|
||||
`
|
||||
|
||||
regex := regexp.MustCompile(`(?s)<value>(\d+)</value>`)
|
||||
luaExpr := BuildLuaScript("v1 = math.sqrt(v1)")
|
||||
luaExpr := BuildLuaScript("v1 = math.sqrt(v1)", "")
|
||||
|
||||
modifiedContent, _, _, err := APIAdaptor(content, regex.String(), luaExpr)
|
||||
assert.NoError(t, err, "Error processing content: %v", err)
|
||||
@@ -308,7 +308,7 @@ func TestDirectAssignment(t *testing.T) {
|
||||
`
|
||||
|
||||
regex := regexp.MustCompile(`(?s)<value>(\d+)</value>`)
|
||||
luaExpr := BuildLuaScript("=0")
|
||||
luaExpr := BuildLuaScript("=0", "")
|
||||
|
||||
modifiedContent, _, _, err := APIAdaptor(content, regex.String(), luaExpr)
|
||||
assert.NoError(t, err, "Error processing content: %v", err)
|
||||
@@ -366,7 +366,7 @@ func TestStringAndNumericOperations(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Compile the regex pattern with multiline support
|
||||
pattern := "(?s)" + tt.regexPattern
|
||||
luaExpr := BuildLuaScript(tt.luaExpression)
|
||||
luaExpr := BuildLuaScript(tt.luaExpression, "")
|
||||
|
||||
// Process with our function
|
||||
result, modCount, _, err := APIAdaptor(tt.input, pattern, luaExpr)
|
||||
@@ -427,7 +427,7 @@ func TestEdgeCases(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Make sure the regex can match across multiple lines
|
||||
pattern := "(?s)" + tt.regexPattern
|
||||
luaExpr := BuildLuaScript(tt.luaExpression)
|
||||
luaExpr := BuildLuaScript(tt.luaExpression, "")
|
||||
|
||||
// Process with our function
|
||||
result, modCount, _, err := APIAdaptor(tt.input, pattern, luaExpr)
|
||||
|
||||
Reference in New Issue
Block a user