-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: only require unix for file and dir examples
- Loading branch information
1 parent
78901ef
commit 9f8e98c
Showing
6 changed files
with
92 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) The Test Authors | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
//go:build unix | ||
|
||
package test | ||
|
||
import ( | ||
"io/fs" | ||
"os" | ||
) | ||
|
||
func ExampleDirExists() { | ||
DirExists(t, "/tmp") | ||
// Output: | ||
} | ||
|
||
func ExampleDirNotExists() { | ||
DirNotExists(t, "/does/not/exist") | ||
// Output: | ||
} | ||
|
||
func ExampleFileContains() { | ||
_ = os.WriteFile("/tmp/example", []byte("foo bar baz"), fs.FileMode(0600)) | ||
FileContains(t, "/tmp/example", "bar") | ||
// Output: | ||
} | ||
|
||
func ExampleFileExists() { | ||
_ = os.WriteFile("/tmp/example", []byte{}, fs.FileMode(0600)) | ||
FileExists(t, "/tmp/example") | ||
// Output: | ||
} | ||
|
||
func ExampleFileMode() { | ||
_ = os.WriteFile("/tmp/example_fm", []byte{}, fs.FileMode(0600)) | ||
FileMode(t, "/tmp/example_fm", fs.FileMode(0600)) | ||
// Output: | ||
} | ||
|
||
func ExampleFileNotExists() { | ||
FileNotExists(t, "/tmp/not_existing_file") | ||
// Output: | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters