aboutsummaryrefslogtreecommitdiff
path: root/lib/os/example_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-09 00:37:21 +0700
committerShulhan <ms@kilabit.info>2026-01-09 00:38:08 +0700
commit34693c1b7ab126e1fbda3810eb46b735c350505c (patch)
treef2437def68eb031c9482d409804941edf70c8c62 /lib/os/example_test.go
parent0fde383e8f30a0d7504e7987f6a3ebe6a082d69a (diff)
downloadpakakeh.go-34693c1b7ab126e1fbda3810eb46b735c350505c.tar.xz
lib/os: add function IsBinaryStream
The IsBinaryStream return true if the content has more than 75% non-printable characters, excluding spaces. While at it, replace the body of IsBinary with it and update the test cases to use the internal files.
Diffstat (limited to 'lib/os/example_test.go')
-rw-r--r--lib/os/example_test.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/os/example_test.go b/lib/os/example_test.go
index 574490a6..5fc15488 100644
--- a/lib/os/example_test.go
+++ b/lib/os/example_test.go
@@ -1,6 +1,5 @@
-// Copyright 2023, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2023 M. Shulhan <ms@kilabit.info>
package os_test
@@ -22,8 +21,8 @@ func ExampleEnvironments() {
}
func ExampleIsBinary() {
- fmt.Println(libos.IsBinary("/bin/bash"))
- fmt.Println(libos.IsBinary("io.go"))
+ fmt.Println(libos.IsBinary(`testdata/exp.bz2`))
+ fmt.Println(libos.IsBinary(`os.go`))
// Output:
// true
// false