feat(package): hemar: I think I was wrong

This commit is contained in:
2025-11-25 15:45:02 +00:00
parent 4729770b59
commit 8a08272f68
3 changed files with 107 additions and 35 deletions

View File

@@ -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 {"

View 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"