MCPcopy Create free account
hub / github.com/evilsocket/sum / TestServiceCompiler

Function TestServiceCompiler

service/compiler_test.go:22–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestServiceCompiler(t *testing.T) {
23 for _, u := range units {
24 t.Run(u.oracle.Name, func(t *testing.T) {
25 compiled, err := compile(&u.oracle)
26 if u.expectedError {
27 if err == nil {
28 t.Fatal("an error was expected")
29 } else if !strings.Contains(strings.ToLower(err.Error()), strings.ToLower(u.expectedErrorMessage)) {
30 t.Fatalf("expected error message '%s', got '%s'", u.expectedErrorMessage, err)
31 }
32 } else if err != nil {
33 t.Fatal(err)
34 } else if !compiled.Is(u.oracle) {
35 t.Fatal("compiled oracle does not match source object")
36 }
37 })
38 }
39}

Callers

nothing calls this directly

Calls 4

compileFunction · 0.85
ErrorMethod · 0.80
RunMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected