diff options
| author | Dax Raad <[email protected]> | 2025-05-30 20:47:56 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-30 20:48:36 -0400 |
| commit | f3da73553c45f17e04b1e77cb13eb0fca714d1bd (patch) | |
| tree | a24317a19e1ab2a89da50db669dc6894f15d00d1 /internal/format/format_test.go | |
| parent | 9a26b3058ffc1023e5c7e54b6d571c903d15888e (diff) | |
| download | opencode-f3da73553c45f17e04b1e77cb13eb0fca714d1bd.tar.gz opencode-f3da73553c45f17e04b1e77cb13eb0fca714d1bd.zip | |
sync
Diffstat (limited to 'internal/format/format_test.go')
| -rw-r--r-- | internal/format/format_test.go | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/internal/format/format_test.go b/internal/format/format_test.go deleted file mode 100644 index 04054a7c4..000000000 --- a/internal/format/format_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package format - -import ( - "testing" -) - -func TestOutputFormat_IsValid(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - format OutputFormat - want bool - }{ - { - name: "text format", - format: TextFormat, - want: true, - }, - { - name: "json format", - format: JSONFormat, - want: true, - }, - { - name: "invalid format", - format: "invalid", - want: false, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - if got := tt.format.IsValid(); got != tt.want { - t.Errorf("OutputFormat.IsValid() = %v, want %v", got, tt.want) - } - }) - } -} - -func TestFormatOutput(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - content string - format OutputFormat - want string - wantErr bool - }{ - { - name: "text format", - content: "test content", - format: TextFormat, - want: "test content", - wantErr: false, - }, - { - name: "json format", - content: "test content", - format: JSONFormat, - want: "{\n \"response\": \"test content\"\n}", - wantErr: false, - }, - { - name: "invalid format", - content: "test content", - format: "invalid", - want: "", - wantErr: true, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - got, err := FormatOutput(tt.content, tt.format) - if (err != nil) != tt.wantErr { - t.Errorf("FormatOutput() error = %v, wantErr %v", err, tt.wantErr) - return - } - if got != tt.want { - t.Errorf("FormatOutput() = %v, want %v", got, tt.want) - } - }) - } -} |
