feat(package): hemar: I think I was wrong
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
answer="$(echo 'some text' | hemar -c)"
|
||||
answer="$(printf '%s' 'some text' | hemar -c)"
|
||||
|
||||
expected="$(printf '[
|
||||
expected="$(printf '%s' '[
|
||||
{
|
||||
"type": "text",
|
||||
"value": "some text"
|
||||
@@ -9,9 +9,9 @@ expected="$(printf '[
|
||||
|
||||
json_diff "$answer" "$expected"
|
||||
|
||||
answer="$(echo 'some [] {} text' | hemar -c)"
|
||||
answer="$(printf '%s' 'some [] {} text' | hemar -c)"
|
||||
|
||||
expected="$(printf '[
|
||||
expected="$(printf '%s' '[
|
||||
{
|
||||
"type": "text",
|
||||
"value": "some [] {} text"
|
||||
@@ -20,9 +20,9 @@ expected="$(printf '[
|
||||
|
||||
json_diff "$answer" "$expected"
|
||||
|
||||
answer="$(echo 'some {' | hemar -c)"
|
||||
answer="$(printf '%s' 'some {' | hemar -c)"
|
||||
|
||||
expected="$(printf '[
|
||||
expected="$(printf '%s' '[
|
||||
{
|
||||
"type": "text",
|
||||
"value": "some {"
|
||||
38
test/package/hemar/test/some-interpolations.sh
Normal file
38
test/package/hemar/test/some-interpolations.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
answer="$(printf '%s' 'text begind {[ "inn \\e\"r"-t\"ext ]}' | hemar -c)"
|
||||
|
||||
expected="$(printf '%s' '[
|
||||
{
|
||||
"type": "text",
|
||||
"value": "text begind "
|
||||
},
|
||||
{
|
||||
"type": "interpolation",
|
||||
"path": "inn \\e\"r-t\"ext"
|
||||
}
|
||||
]')"
|
||||
|
||||
json_diff "$answer" "$expected"
|
||||
|
||||
[ "$(printf '%s' "$answer" | yq '.[1] | .path')" = 'inn \e"r-t"ext' ] || {
|
||||
log error 'unexpected'
|
||||
exit 1
|
||||
}
|
||||
|
||||
answer="$(printf '%s' 'text begind {[ [" "] ]}' | hemar -c)"
|
||||
|
||||
expected="$(printf '%s' '[
|
||||
{
|
||||
"type": "text",
|
||||
"value": "text begind "
|
||||
},
|
||||
{
|
||||
"type": "interpolation",
|
||||
"path": "[ ]"
|
||||
}
|
||||
]')"
|
||||
|
||||
json_diff "$answer" "$expected"
|
||||
|
||||
answer="$(printf '%s' 'text begind {[ [" "\ ] ]}' | hemar -c)"
|
||||
|
||||
json_diff "$answer" "$expected"
|
||||
Reference in New Issue
Block a user