MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / TestRegression

Function TestRegression

cli/cmd/progressbar_test.go:21–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestRegression(t *testing.T) {
22 buf := strings.Builder{}
23
24 bar := progressbar.NewOptions(-1,
25 progressbar.OptionSetWriter(&buf),
26 progressbar.OptionSetDescription("Syncing resources..."),
27 progressbar.OptionSetItsString("resources"),
28 progressbar.OptionShowIts(),
29 progressbar.OptionSetElapsedTime(true),
30 progressbar.OptionShowCount(),
31 )
32 bar.Reset()
33 time.Sleep(1 * time.Second)
34 expectBuffer(t, &buf, "")
35 _ = bar.Add(5)
36 expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s]")
37 time.Sleep(1 * time.Second)
38 _ = bar.Add(5)
39 expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s]")
40 time.Sleep(1 * time.Second)
41 _ = bar.Finish()
42 expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s] \r \r\r- Syncing resources... (10/-, 3 resources/s) [3s]")
43}
44
45func TestRegressionClearOnFinish(t *testing.T) {
46 buf := strings.Builder{}

Callers

nothing calls this directly

Calls 3

expectBufferFunction · 0.85
AddMethod · 0.65
FinishMethod · 0.65

Tested by

no test coverage detected