(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestWriteJSONL(t *testing.T) { |
| 38 | msgs := []models.Message{ |
| 39 | {Role: "user", Content: "hi"}, |
| 40 | {Role: "assistant", Content: "hello"}, |
| 41 | } |
| 42 | var sb strings.Builder |
| 43 | n, err := WriteJSONL(&sb, msgs) |
| 44 | if err != nil { |
| 45 | t.Fatal(err) |
| 46 | } |
| 47 | if n != 2 { |
| 48 | t.Errorf("expected 2 lines, got %d", n) |
| 49 | } |
| 50 | lines := strings.Split(strings.TrimSpace(sb.String()), "\n") |
| 51 | if len(lines) != 2 { |
| 52 | t.Fatalf("expected 2 JSONL lines, got %d", len(lines)) |
| 53 | } |
| 54 | if !strings.HasPrefix(lines[0], `{"from":"human"`) { |
| 55 | t.Errorf("unexpected first line: %s", lines[0]) |
| 56 | } |
| 57 | } |
nothing calls this directly
no test coverage detected