MCPcopy
hub / github.com/nakabonne/ali / TestFileExporter_Quotes

Function TestFileExporter_Quotes

export/export_test.go:104–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func 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
130func TestFileExporter_EmptyResults(t *testing.T) {
131 dir := t.TempDir()

Callers

nothing calls this directly

Calls 6

StartRunMethod · 0.95
NewFileExporterFunction · 0.85
readGoldenFunction · 0.85
readFileFunction · 0.85
WriteResultMethod · 0.80
CloseMethod · 0.80

Tested by

no test coverage detected