(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestCompileAndRun(t *testing.T) { |
| 43 | testProgram := "/$/ {}\n" |
| 44 | store := metrics.NewStore() |
| 45 | lines := make(chan *logline.LogLine) |
| 46 | var wg sync.WaitGroup |
| 47 | l, err := New(lines, &wg, "", store) |
| 48 | testutil.FatalIfErr(t, err) |
| 49 | if err := l.CompileAndRun("Test", strings.NewReader(testProgram)); err != nil { |
| 50 | t.Errorf("CompileAndRun returned error: %s", err) |
| 51 | } |
| 52 | l.handleMu.Lock() |
| 53 | if len(l.handles) < 1 { |
| 54 | t.Errorf("no vm handles: %v", l.handles) |
| 55 | } |
| 56 | l.handleMu.Unlock() |
| 57 | l.handleMu.Lock() |
| 58 | h := l.handles["Test"] |
| 59 | if h == nil { |
| 60 | t.Errorf("No handle for Test: %v", l.handles) |
| 61 | } |
| 62 | l.handleMu.Unlock() |
| 63 | close(lines) |
| 64 | wg.Wait() |
| 65 | } |
| 66 | |
| 67 | var testProgram = "/$/ {}\n" |
| 68 |
nothing calls this directly
no test coverage detected