Skip to content

Commit

Permalink
Take hashicorp#25144 into account
Browse files Browse the repository at this point in the history
  • Loading branch information
cgetzen committed Jun 8, 2020
1 parent c0dcad4 commit b95646a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
33 changes: 0 additions & 33 deletions configs/named_values_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/eval_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func looksLikeSentences(s string) bool {
}
runes := []rune(s) // HCL guarantees that all strings are valid UTF-8
first := runes[0]
last := runes[len(s)-1]
last := runes[len(runes)-1]

// If the first rune is a letter then it must be an uppercase letter.
// (This will only see the first rune in a multi-rune combining sequence,
Expand Down
29 changes: 29 additions & 0 deletions terraform/eval_variable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,35 @@ import (
"github.com/hashicorp/terraform/providers"
)

func Test_looksLikeSentences(t *testing.T) {
tests := map[string]struct {
args string
want bool
}{
"empty sentence": {
args: "",
want: false,
},
"valid sentence": {
args: "A valid sentence.",
want: true,
},
"valid sentence with an accent": {
args: `A Valid sentence with an accent "é".`,
want: true,
},
}

for name, tt := range tests {
t.Run(name, func(t *testing.T) {
if got := looksLikeSentences(tt.args); got != tt.want {
t.Errorf("looksLikeSentences() = %v, want %v", got, tt.want)
}
})
}
}


func TestContext2Apply_variableCustomValidationsRoot(t *testing.T) {
// This test is for custom validation rules associated with root module
// variables, and specifically that we handle the situation where their
Expand Down

0 comments on commit b95646a

Please sign in to comment.