@@ -22,6 +22,11 @@ func ExampleLinesString() {
2222 // Output: [hello there]
2323}
2424
25+ func ExampleLinesStringIter_String () {
26+ fmt .Println (iter .LinesString (bytes .NewBufferString ("hello\n there" )))
27+ // Output: Iterator<LinesString, type=Result<string>>
28+ }
29+
2530func ExampleLines () {
2631 lines := iter .Lines (bytes .NewBufferString ("hello\n there" ))
2732 unwrapped := iter .Map [result.Result [[]byte ]](lines , ops.UnwrapResult [[]byte ])
@@ -30,6 +35,11 @@ func ExampleLines() {
3035 // Output: [[104 101 108 108 111] [116 104 101 114 101]]
3136}
3237
38+ func ExampleLinesIter_String () {
39+ fmt .Println (iter .Lines (bytes .NewBufferString ("hello\n there" )))
40+ // Output: Iterator<Lines, type=Result<[]byte>>
41+ }
42+
3343func TestLines (t * testing.T ) {
3444 file , err := os .Open ("fixtures/lines.txt" )
3545 assert .Nil (t , err )
@@ -92,6 +102,14 @@ func TestLinesCollectResults(t *testing.T) {
92102 assert .Empty [byte ](t , lines [4 ])
93103}
94104
105+ func TestLinesIter_String (t * testing.T ) {
106+ lines := iter .Lines (new (bytes.Buffer ))
107+ expected := "Iterator<Lines, type=Result<[]byte>>"
108+
109+ assert .Equal (t , fmt .Sprintf ("%s" , lines ), expected ) //nolint:gosimple
110+ assert .Equal (t , fmt .Sprintf ("%s" , * lines ), expected ) //nolint:gosimple
111+ }
112+
95113func TestLinesString (t * testing.T ) {
96114 file , err := os .Open ("fixtures/lines.txt" )
97115 assert .Nil (t , err )
@@ -154,3 +172,11 @@ func TestLinesStringCollectResults(t *testing.T) {
154172 []string {"This is" , "a file" , "with" , "a trailing newline" , "" },
155173 )
156174}
175+
176+ func TestLinesStringIter_String (t * testing.T ) {
177+ lines := iter .LinesString (new (bytes.Buffer ))
178+ expected := "Iterator<LinesString, type=Result<string>>"
179+
180+ assert .Equal (t , fmt .Sprintf ("%s" , lines ), expected ) //nolint:gosimple
181+ assert .Equal (t , fmt .Sprintf ("%s" , * lines ), expected ) //nolint:gosimple
182+ }
0 commit comments