MCPcopy
hub / github.com/sqlc-dev/sqlc / TestReturnsErrorWhenPathDoesNotExist

Function TestReturnsErrorWhenPathDoesNotExist

internal/sql/sqlpath/read_test.go:97–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestReturnsErrorWhenPathDoesNotExist(t *testing.T) {
98 // Arrange
99 paths := []string{"non_existent_path"}
100
101 // Act
102 result, err := Glob(paths)
103
104 // Assert
105 var expected []string
106 if !cmp.Equal(result, expected) {
107 t.Errorf("Expected %v, but got %v", expected, result)
108 }
109 if err == nil {
110 t.Errorf("Expected an error, but got nil")
111 } else {
112 expectedError := fmt.Errorf("path error:")
113 if !strings.HasPrefix(err.Error(), expectedError.Error()) {
114 t.Errorf("Expected error %v, but got %v", expectedError, err)
115 }
116 }
117}
118
119func TestReturnsErrorWhenDirectoryCannotBeRead(t *testing.T) {
120 // Arrange

Callers

nothing calls this directly

Calls 3

GlobFunction · 0.85
EqualMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected