Skip to content

Commit

Permalink
Add new test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Ulysses Souza <[email protected]>
  • Loading branch information
ulyssessouza committed Mar 23, 2024
1 parent a6b253e commit d8a2804
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions envlang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ A = "aaa ${B} ccc "
}
}

//nolint:funlen
func TestFull(t *testing.T) {
log.SetLevel(log.DebugLevel)
is := `
Expand Down Expand Up @@ -300,6 +301,14 @@ SPECIAL4 = "{{{ $ $ $}}}"
SPECIAL5 = "{{{ $$ }}}"
SPECIAL6 = "{{{ $$$ }}}"
SPECIAL_CHAR_A=unquoted phrase special ã char
SPECIAL_CHAR_C=unquoted phrase special ç char
SPECIAL_CHAR_E=unquoted phrase special è char
VAR-WITH-DASHES="dashes"
VAR.WITH.DOTS="dots"
VAR_WITH_UNDERSCORES="underscores"
EMPTY_VAR=""
VAR_DEFAULT_UNSET = "${UNSET_VAR-uuu}"
Expand Down Expand Up @@ -341,6 +350,12 @@ export EQUALS='postgres://localhost:5432/database?sslmode=disable'
"OPTION_B": strPtr("\\n"),
"EQUALS": strPtr("postgres://localhost:5432/database?sslmode=disable"),
"VAR_TO_BE_LOADED_FROM_OS_ENV": strPtr("loaded_from_os_env"),
"VAR-WITH-DASHES": strPtr("dashes"),
"VAR.WITH.DOTS": strPtr("dots"),
"VAR_WITH_UNDERSCORES": strPtr("underscores"),
"SPECIAL_CHAR_A": strPtr("unquoted phrase special ã char"),
"SPECIAL_CHAR_C": strPtr("unquoted phrase special ç char"),
"SPECIAL_CHAR_E": strPtr("unquoted phrase special è char"),
}

d := dao.NewDefaultDaoFromMap(map[string]*string{
Expand Down
2 changes: 1 addition & 1 deletion handlers/filehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (l *EnvLangFileListener) ExitEntry(c *fileparser.EntryContext) {
if strings.HasPrefix(id, "#") {
return
}
re := regexp.MustCompile(`^[0-9a-zA-Z_]+$`)
re := regexp.MustCompile(`^[0-9a-zA-Z_\-.]+$`)
if !re.MatchString(id) {
return
}
Expand Down

0 comments on commit d8a2804

Please sign in to comment.