MCPcopy Create free account
hub / github.com/schollz/progressbar / TestOptionFullWidth

Function TestOptionFullWidth

progressbar_test.go:883–1002  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

881}
882
883func TestOptionFullWidth(t *testing.T) {
884 var tests = []struct {
885 opts []Option
886 expected string
887 }{
888 { // 1
889 []Option{},
890 "" +
891 "\r 10% |██████ | [1s:9s]" +
892 "\r \r" +
893 "\r 100% |██████████████████████████████████████████████████████████████| ",
894 },
895 { // 2
896 []Option{OptionSetDescription("Progress:")},
897 "" +
898 "\rProgress: 10% |█████ | [1s:9s]" +
899 "\r \r" +
900 "\rProgress: 100% |█████████████████████████████████████████████████████| ",
901 },
902 { // 3
903 []Option{OptionSetDescription("<1/5>"), OptionShowDescriptionAtLineEnd()},
904 "" +
905 "\r 10% |█████ | [1s:9s] <1/5>" +
906 "\r \r" +
907 "\r 100% |████████████████████████████████████████████████████████| <1/5>",
908 },
909 { // 4
910 []Option{OptionSetPredictTime(false)},
911 "" +
912 "\r 10% |██████ | " +
913 "\r \r" +
914 "\r 100% |█████████████████████████████████████████████████████████████████████| ",
915 },
916 { // 5
917 []Option{OptionSetPredictTime(false), OptionShowElapsedTimeOnFinish()},
918 "" +
919 "\r 10% |██████ | " +
920 "\r \r" +
921 "\r 100% |████████████████████████████████████████████████████████████████| [2s] ",
922 },
923 { // 6
924 []Option{OptionSetPredictTime(false), OptionSetElapsedTime(false)},
925 "" +
926 "\r 10% |██████ | " +
927 "\r \r" +
928 "\r 100% |█████████████████████████████████████████████████████████████████████| ",
929 },
930 { // 7
931 []Option{OptionShowIts()},
932 "" +
933 "\r 10% |█████ | (10 it/s) [1s:9s]" +
934 "\r \r" +
935 "\r 100% |█████████████████████████████████████████████████████| (50 it/s)",
936 },
937 { // 8
938 []Option{OptionShowCount()},
939 "" +
940 "\r 10% |█████ | (10/100) [1s:9s]" +

Callers

nothing calls this directly

Calls 13

OptionSetDescriptionFunction · 0.85
OptionSetPredictTimeFunction · 0.85
OptionSetElapsedTimeFunction · 0.85
OptionShowItsFunction · 0.85
OptionShowCountFunction · 0.85
NewOptionsFunction · 0.85
OptionFullWidthFunction · 0.85
OptionSetWriterFunction · 0.85
StartWithoutRenderMethod · 0.80
AddMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…