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

Function TestRegressionClearOnFinish

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

Source from the content-addressed store, hash-verified

43}
44
45func TestRegressionClearOnFinish(t *testing.T) {
46 buf := strings.Builder{}
47
48 bar := progressbar.NewOptions(-1,
49 progressbar.OptionSetWriter(&buf),
50 progressbar.OptionSetDescription("Syncing resources..."),
51 progressbar.OptionSetItsString("resources"),
52 progressbar.OptionShowIts(),
53 progressbar.OptionSetElapsedTime(true),
54 progressbar.OptionShowCount(),
55 progressbar.OptionClearOnFinish(),
56 )
57 bar.Reset()
58 time.Sleep(1 * time.Second)
59 expectBuffer(t, &buf, "")
60 _ = bar.Add(5)
61 expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s]")
62 time.Sleep(1 * time.Second)
63 _ = bar.Add(5)
64 expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s]")
65 time.Sleep(1 * time.Second)
66 _ = bar.Finish()
67 expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s]")
68}

Callers

nothing calls this directly

Calls 3

expectBufferFunction · 0.85
AddMethod · 0.65
FinishMethod · 0.65

Tested by

no test coverage detected