Skip to content

Commit b919405

Browse files
authored
structure_test mode: add more test cases (#246)
Response to comments in #243 (comment) Signed-off-by: Jason Hall <[email protected]>
1 parent f59f102 commit b919405

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

internal/provider/structure_test_data_source_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ func TestParseFileMode(t *testing.T) {
227227
{"0755", 0755},
228228
{"0777", 0777},
229229
{"0000", 0000},
230+
{"777", 0777},
231+
{"644", 0644},
232+
{"75", 0075},
233+
{"1", 0001},
230234
}
231235

232236
for _, tt := range tests {
@@ -258,4 +262,18 @@ func TestParseFileMode(t *testing.T) {
258262
t.Error("parseFileMode(\"invalid\") did not return an error")
259263
}
260264
})
265+
266+
t.Run("invalid numerical mode", func(t *testing.T) {
267+
_, err := parseFileMode("0999")
268+
if err == nil {
269+
t.Error("parseFileMode(\"0999\") did not return an error")
270+
}
271+
})
272+
273+
t.Run("invalid octal mode", func(t *testing.T) {
274+
_, err := parseFileMode("0o777")
275+
if err == nil {
276+
t.Error("parseFileMode(\"0o777\") did not return an error")
277+
}
278+
})
261279
}

0 commit comments

Comments
 (0)