aboutsummaryrefslogtreecommitdiff
path: root/object/tree
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-07 11:22:46 +0000
committerGravatar Runxi Yu2026-06-07 11:22:46 +0000
commit1a54667f464398f80fe90dc63539ef2c3f7f5984 (patch)
tree8ef1389c16e3c66a4a120d5905bffdfdc77c8683 /object/tree
parentobject/tree/mode: Parser tests (diff)
signatureNo signature
object/tree/mode: Append tests
Diffstat (limited to 'object/tree')
-rw-r--r--object/tree/mode/append_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/object/tree/mode/append_test.go b/object/tree/mode/append_test.go
new file mode 100644
index 00000000..87037490
--- /dev/null
+++ b/object/tree/mode/append_test.go
@@ -0,0 +1,31 @@
+package mode_test
+
+import (
+ "testing"
+
+ "lindenii.org/go/furgit/object/tree/mode"
+)
+
+func TestAppend(t *testing.T) {
+ t.Parallel()
+
+ for _, tc := range []struct {
+ mode mode.Mode
+ want string
+ }{
+ {mode: mode.Directory, want: "40000"},
+ {mode: mode.Regular, want: "100644"},
+ {mode: mode.Executable, want: "100755"},
+ {mode: mode.Symlink, want: "120000"},
+ {mode: mode.Gitlink, want: "160000"},
+ } {
+ t.Run(tc.want, func(t *testing.T) {
+ t.Parallel()
+
+ got := string(tc.mode.Append(nil))
+ if got != tc.want {
+ t.Fatalf("Append() = %q, want %q", got, tc.want)
+ }
+ })
+ }
+}