aboutsummaryrefslogtreecommitdiff
path: root/lib/os/os_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/os/os_test.go')
-rw-r--r--lib/os/os_test.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/os/os_test.go b/lib/os/os_test.go
index 0bacb67a..88c420c5 100644
--- a/lib/os/os_test.go
+++ b/lib/os/os_test.go
@@ -1,6 +1,5 @@
-// Copyright 2022, 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: 2022 M. Shulhan <ms@kilabit.info>
package os
@@ -116,6 +115,27 @@ func TestCopy(t *testing.T) {
}
}
+func TestIsBinaryStream(t *testing.T) {
+ listCase := []struct {
+ path string
+ exp bool
+ }{{
+ path: `testdata/exp.bz2`,
+ exp: true,
+ }, {
+ path: `os.go`,
+ exp: false,
+ }}
+ for _, tc := range listCase {
+ content, err := os.ReadFile(tc.path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := IsBinaryStream(content)
+ test.Assert(t, tc.path, tc.exp, got)
+ }
+}
+
func TestIsDirEmpty(t *testing.T) {
emptyDir := "testdata/dirempty"
err := os.MkdirAll(emptyDir, 0700)