Skip to content

Commit

Permalink
Test trim before rewrite
Browse files Browse the repository at this point in the history
The current contextPattern is quite constraining and would fail the
rewrite of a context with trailing spaces. Triming happens during the
execution of Interpolate, and these tests aim to detect future breaking
changes on this behavior.
  • Loading branch information
badouralix committed Jun 23, 2020
1 parent 3247400 commit 6d75931
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/runner/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ func TestInterpolate(t *testing.T) {
Workdir: ".",
},
Env: map[string]string{
"key": "value",
"keywithnothing": "valuewithnothing",
"key-with-hyphens": "value-with-hyphens",
"key_with_underscores": "value_with_underscores",
},
Run: &model.Run{
JobID: "job1",
Expand All @@ -139,7 +141,9 @@ func TestInterpolate(t *testing.T) {
out string
}{
{" ${{1}} to ${{2}} ", " 1 to 2 "},
{" ${{ env.key }} ", " value "},
{" ${{ env.keywithnothing }} ", " valuewithnothing "},
{" ${{ env.key-with-hyphens }} ", " value-with-hyphens "},
{" ${{ env.key_with_underscores }} ", " value_with_underscores "},
{"${{ env.unknown }}", ""},
}

Expand Down

0 comments on commit 6d75931

Please sign in to comment.