diff --git a/src/test/e2e/__snapshots__/func.spec.ts.snap b/src/test/e2e/__snapshots__/func.spec.ts.snap index 1003581..fb65fc1 100644 --- a/src/test/e2e/__snapshots__/func.spec.ts.snap +++ b/src/test/e2e/__snapshots__/func.spec.ts.snap @@ -16,6 +16,30 @@ PROGRAM{ }END>c" `; +exports[`disassemble > should decompile SDBEGINSXQ correctly 1`] = ` +""Asm.fif" include +PROGRAM{ + DECLPROC recv_internal + recv_internal PROC:<{ + NEWC + x{68656C6C6F20776F726C64} PUSHSLICE + STSLICER + ENDC + CTOS + NEWC + x{68656C6C6F} PUSHSLICE + STSLICER + ENDC + CTOS + DUP2 + SDBEGINSX + ROTREV + SDBEGINSXQ + DROP2 + }> +}END>c" +`; + exports[`disassemble > should decompile and compile back PUSHREF with bytes 1`] = ` ""Asm.fif" include PROGRAM{ diff --git a/src/test/e2e/func.spec.ts b/src/test/e2e/func.spec.ts index 0a104df..6124a24 100644 --- a/src/test/e2e/func.spec.ts +++ b/src/test/e2e/func.spec.ts @@ -39,6 +39,29 @@ describe("disassemble", () => { `) }) + it("should decompile SDBEGINSXQ correctly", async () => { + await compileAndCheck(` + forall X -> (X, ()) ~impure_touch(X x) impure asm "NOP"; + + builder begin_cell() asm "NEWC"; + builder store_slice(builder b, slice s) asm "STSLICER"; + cell end_cell(builder b) asm "ENDC"; + slice begin_parse(cell c) asm "CTOS"; + + slice trim_prefix(slice where, slice prefix) asm "SDBEGINSX"; + slice trim_prefix_quite(slice where, slice prefix) asm "SDBEGINSXQ"; + + () recv_internal() { + slice where = begin_cell().store_slice("hello world").end_cell().begin_parse(); + slice prefix = begin_cell().store_slice("hello").end_cell().begin_parse(); + slice result = trim_prefix(where, prefix); + slice result2 = trim_prefix_quite(where, prefix); + ~impure_touch(result); + ~impure_touch(result2); + } + `) + }) + async function compileAndCheck(content: string) { const funcRes = await compileFunc({ sources: [