(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestFileExporter_Quotes(t *testing.T) { |
| 105 | dir := t.TempDir() |
| 106 | exporter := NewFileExporter(dir) |
| 107 | zone := time.FixedZone("JST", 9*60*60) |
| 108 | |
| 109 | run, err := exporter.StartRun(Meta{ |
| 110 | ID: "11111111-1111-1111-1111-111111111111", |
| 111 | TargetURL: "https://example.com/hello, \"world\"", |
| 112 | Method: "GET", |
| 113 | Rate: 1, |
| 114 | Duration: time.Second, |
| 115 | }) |
| 116 | require.NoError(t, err) |
| 117 | |
| 118 | require.NoError(t, run.WriteResult(Result{ |
| 119 | Timestamp: time.Date(2021, 3, 13, 15, 20, 43, 0, zone), |
| 120 | LatencyNS: 123, |
| 121 | StatusCode: 200, |
| 122 | })) |
| 123 | require.NoError(t, run.Close(Summary{})) |
| 124 | |
| 125 | wantResults := readGolden(t, filepath.Join("..", "testdata", "export", "quotes", "results.csv")) |
| 126 | gotResults := readFile(t, filepath.Join(dir, resultsFilename)) |
| 127 | require.Equal(t, string(wantResults), string(gotResults)) |
| 128 | } |
| 129 | |
| 130 | func TestFileExporter_EmptyResults(t *testing.T) { |
| 131 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected