Skip to content

Commit

Permalink
test: add test cases for parsing one-part-function
Browse files Browse the repository at this point in the history
  • Loading branch information
rycont authored Jan 26, 2025
1 parent d5c205b commit 7a268f8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/codes/one-part-function.yak
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
약속, 회전설정
결과: "rotate"

(회전설정) + 회전설정 * 3 보여주기
1 change: 1 addition & 0 deletions test/codes/one-part-function.yak.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rotaterotaterotaterotate
33 changes: 33 additions & 0 deletions test/connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,36 @@ wait

assertEquals(output, ['안녕!', '반가워!'])
})

Deno.test('한 단어로 된 FFI 이름', async () => {
let output = ''
await yaksok(
`
번역(QuickJS), 물어보기
***
return "성공"
***
(물어보기) + 물어보기 * 3 보여주기
`,
{
runFFI(runtime, bodyCode, args) {
if (runtime === 'QuickJS') {
const result = quickJS.run(bodyCode, args)
if (!result) {
throw new Error('Result is null')
}

return result
}

throw new Error(`Unknown runtime: ${runtime}`)
},
stdout(value) {
output += value + '\n'
},
},
)

assertEquals(output, '성공성공성공성공\n')
})

0 comments on commit 7a268f8

Please sign in to comment.