Add an example of our CommentStripper that doubles as a test

This commit is contained in:
Tianon Gravi 2017-03-31 15:06:00 -07:00
parent 2b0958eb1b
commit 8e09786a2f
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package stripper_test
import (
"io"
"os"
"strings"
"github.com/docker-library/go-dockerlibrary/pkg/stripper"
)
func ExampleCommentStripper() {
r := strings.NewReader(`
# opening comment
a: b
# comment!
c: d # not a comment
# another cheeky comment
e: f
`)
comStrip := stripper.NewCommentStripper(r)
io.Copy(os.Stdout, comStrip)
// Output:
// a: b
// c: d # not a comment
//
// e: f
}