mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 08:21:07 -06:00
lang: Add test for jsonencode entity escaping
The encoding/json package escapes some HTML-specific characters to prevent JSON from being misinterpreted when in the context of an HTML document. Terraform 0.11 used this behaviour, and to preserve backwards compatibility we are continuing to do so moving forward. This commit adds an explicit test to document that this is intentional, not a bug.
This commit is contained in:
parent
79e35941f5
commit
c7568ccceb
@ -472,6 +472,12 @@ func TestFunctions(t *testing.T) {
|
||||
`jsonencode({"hello"="world"})`,
|
||||
cty.StringVal("{\"hello\":\"world\"}"),
|
||||
},
|
||||
// We are intentionally choosing to escape <, >, and & characters
|
||||
// to preserve backwards compatibility with Terraform 0.11
|
||||
{
|
||||
`jsonencode({"hello"="<cats & kittens>"})`,
|
||||
cty.StringVal("{\"hello\":\"\\u003ccats \\u0026 kittens\\u003e\"}"),
|
||||
},
|
||||
},
|
||||
|
||||
"keys": {
|
||||
|
Loading…
Reference in New Issue
Block a user