Skip to content

Commit

Permalink
fix: fix typo (#382)
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe authored Jul 15, 2024
1 parent 81bcdec commit 09233a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func DirExists(path string) bool {
return err == nil
}

const ModRelativePathPattern = `^\$\{[^}]+:KCL_MOD\}/main\.k$`
const ModRelativePathPattern = `\$\{([a-zA-Z0-9_-]+:)?KCL_MOD\}/`

// If the path preffix is `${KCL_MOD}` or `${KCL_MOD:xxx}`
func IsModRelativePath(s string) bool {
Expand Down
6 changes: 6 additions & 0 deletions pkg/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,9 @@ func TestIsSymlinkExist(t *testing.T) {
assert.Equal(t, err, nil)
}()
}

func TestIsModRelativePath(t *testing.T) {
assert.Equal(t, IsModRelativePath("${KCL_MOD}/aaa"), true)
assert.Equal(t, IsModRelativePath("${helloworld:KCL_MOD}/aaa"), true)
assert.Equal(t, IsModRelativePath("xxx/xxx/xxx"), false)
}

0 comments on commit 09233a5

Please sign in to comment.