Skip to content

Commit

Permalink
Add ExampleFromFileWithFS
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
  • Loading branch information
hairyhenderson committed Dec 31, 2022
1 parent 662f5b1 commit bc7bdc1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions codeowners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"io"
"os"
"path"
"runtime"
"strings"
Expand Down Expand Up @@ -276,6 +277,16 @@ func ExampleFromFile() {
// * @hairyhenderson
}

func ExampleFromFileWithFS() {
// open filesystem rooted at current working directory
fsys := os.DirFS(cwd())

c, _ := FromFileWithFS(fsys, ".")
fmt.Println(c.Patterns[0])
// Output:
// * @hairyhenderson
}

func ExampleFromReader() {
reader := strings.NewReader(sample2)
c, _ := FromReader(reader, "")
Expand Down

0 comments on commit bc7bdc1

Please sign in to comment.