Full expression and validation support
This commit is contained in:
39
test/expression_whitespace_test.go
Normal file
39
test/expression_whitespace_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/marte-community/marte-dev-tools/internal/builder"
|
||||
)
|
||||
|
||||
func TestExpressionWhitespace(t *testing.T) {
|
||||
content := `
|
||||
+Obj = {
|
||||
NoSpace = 2+2
|
||||
WithSpace = 2 + 2
|
||||
}
|
||||
`
|
||||
f, _ := os.CreateTemp("", "expr_ws.marte")
|
||||
f.WriteString(content)
|
||||
f.Close()
|
||||
defer os.Remove(f.Name())
|
||||
|
||||
b := builder.NewBuilder([]string{f.Name()}, nil)
|
||||
|
||||
outF, _ := os.CreateTemp("", "out.marte")
|
||||
defer os.Remove(outF.Name())
|
||||
b.Build(outF)
|
||||
outF.Close()
|
||||
|
||||
outContent, _ := os.ReadFile(outF.Name())
|
||||
outStr := string(outContent)
|
||||
|
||||
if !strings.Contains(outStr, "NoSpace = 4") {
|
||||
t.Errorf("NoSpace failed. Got:\n%s", outStr)
|
||||
}
|
||||
if !strings.Contains(outStr, "WithSpace = 4") {
|
||||
t.Errorf("WithSpace failed. Got:\n%s", outStr)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user