NAME=rz =
FILE==
CMDS=e file.path
EXPECT=<<EOF

EOF
RUN

NAME=rz =
FILE==
CMDS=e file.lastpath
EXPECT=<<EOF

EOF
RUN

NAME=rz --
FILE=--
CMDS=e file.path
EXPECT=<<EOF

EOF
RUN

NAME=rz --
FILE=bins/elf/bomb
BROKEN=1
CMDS=rizin -s main -qcs bins/elf/bomb
EXPECT=<<EOF
0x400da0
EOF
RUN

NAME=seek undo/redo
FILE==
CMDS=<<EOF
wx 01
s 1
shu
shr
pb 8
EOF
EXPECT=<<EOF
00000000
EOF
RUN

NAME=seek undo/redo
FILE==
CMDS=wx 01; s 1; shu; shr; pb 8
EXPECT=<<EOF
00000000
EOF
RUN

NAME=rizin -V
FILE==
CMDS=!!rizin -V~rz_arch?
EXPECT=<<EOF
1
EOF
RUN

NAME=rizin -h
FILE==
CMDS=!!rizin -h~Usage?
EXPECT=<<EOF
1
EOF
RUN

NAME=rizin -hh
FILE==
CMDS=!!rizin -hh~RZ_USER_PLUGINS?
EXPECT=<<EOF
1
EOF
RUN

NAME=rizin -L
FILE==
CMDS=!!rizin -L~default?
EXPECT=<<EOF
1
EOF
RUN

NAME=rizin shortcut
FILE==
CMDS=<<EOF
%= `!!rizin -h~Usage?`
%+ %vi $?
%! echo `!!rizin.bat -h~Usage?`
EOF
EXPECT=<<EOF
1
EOF
RUN

NAME=no-nl-at-eof script
FILE==
CMDS=!rizin -i scripts/no-nl-at-eof.rz -Nq =
EXPECT=<<EOF
1
EOF
EXPECT_ERR=
RUN

NAME=rizin -i -Q with missing script
FILE==
CMDS=<<EOF
# Should not hang
!rizin -i script/missing.rz -Nq =
EOF
EXPECT=
EXPECT_ERR=<<EOF
ERROR: Script 'script/missing.rz' not found.
EOF
RUN

NAME=rizin empty -i
FILE==
CMDS=!rizin -i "" =
EXPECT_ERR=<<EOF
ERROR: Cannot open empty script path
EOF
RUN

NAME=rizin empty -I
FILE==
CMDS=!rizin -I "" =
EXPECT_ERR=<<EOF
ERROR: Cannot open empty script path
EOF
RUN

NAME=rizin empty -R
FILE==
CMDS=!rizin -R ""
EXPECT_ERR=
RUN

NAME=rizin project with explicit file
FILE==
CMDS=<<EOF
!rizin -escr.utf8=0 -easm.bytes=1 -escr.color=0 -escr.interactive=0 -N -qc "f easy @ 0x080483fe; Ps .crackme.rzdb" bins/elf/ioli/crackme0x00
echo Same project, different file
!rizin -escr.utf8=0 -easm.bytes=1 -escr.color=0 -escr.interactive=0 -N -p .crackme.rzdb -qc "ol; pdq 3 @ easy" bins/elf/ioli/crackme0x01
!rm .crackme.rzdb
EOF
EXPECT=<<EOF
Same project, different file
 3 * r-x 0x00001d4b bins/elf/ioli/crackme0x01
 4 - r-x 0x00000010 vfile://0/reloc-targets
 5 - rw- 0x00000004 null://4
0x080483fe   easy:
0x080483fe                 29c4  sub esp, eax
0x08048400       c7042428850408  mov dword [esp], str.IOLI_Crackme_Level_0x01
0x08048407           e810ffffff  call sym.imp.printf_0x804831c
EOF
RUN

NAME=rizin project with implicit file
FILE==
CMDS=<<EOF
!rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -qc "f easy @ 0x080483fe; Ps .crackme2.rzdb" bins/elf/ioli/crackme0x00
echo Reload project including file
!rizin -escr.utf8=0 -escr.color=0 -easm.bytes=1 -escr.interactive=0 -N -p .crackme2.rzdb -qc "pdq 3 @ easy"
!rm .crackme2.rzdb
EOF
EXPECT=<<EOF
Reload project including file
0x080483fe   easy:
0x080483fe                 08e8  or al, ch
0x08048400                   fc  cld
0x08048401                 7bfb  jnp 0x80483fe
EOF
RUN

NAME=b/w prompt
FILE==
CMDS=!rizin -e cfg.fortunes=0 -e scr.color=0 -c "< \nq\n" =
EXPECT=<<EOF
[2K

[0x00000000]> 
[0x00000000]> [2K

[0x00000000]> 
[2K

[0x00000000]> 
[0x00000000]> [2K
[2K

[0x00000000]> q
[0x00000000]> q[2K

[0x00000000]> q
EOF
RUN

NAME=prompt settings
FILE==
CMDS=!rizin -e cfg.fortunes=0 -e scr.color=0 -c "< \ne scr.prompt.file=true\ne scr.prompt.flag=true\nsd 1\ne scr.prompt.flag.only=true\ne scr.prompt.sect=true\nq\n" ./bins/elf/hello_world
EXPECT=<<EOF
[2K

[0x000006a0]> 
[0x000006a0]> [2K

[0x000006a0]> 
[2K

[0x000006a0]> 
[0x000006a0]> [2K
[2K

[0x000006a0]> e
[0x000006a0]> e[2K
[2K

[0x000006a0]> e 
[0x000006a0]> e [2K
[2K

[0x000006a0]> e s
[0x000006a0]> e s[2K
[2K

[0x000006a0]> e sc
[0x000006a0]> e sc[2K
[2K

[0x000006a0]> e scr
[0x000006a0]> e scr[2K
[2K

[0x000006a0]> e scr.
[0x000006a0]> e scr.[2K
[2K

[0x000006a0]> e scr.p
[0x000006a0]> e scr.p[2K
[2K

[0x000006a0]> e scr.pr
[0x000006a0]> e scr.pr[2K
[2K

[0x000006a0]> e scr.pro
[0x000006a0]> e scr.pro[2K
[2K

[0x000006a0]> e scr.prom
[0x000006a0]> e scr.prom[2K
[2K

[0x000006a0]> e scr.promp
[0x000006a0]> e scr.promp[2K
[2K

[0x000006a0]> e scr.prompt
[0x000006a0]> e scr.prompt[2K
[2K

[0x000006a0]> e scr.prompt.
[0x000006a0]> e scr.prompt.[2K
[2K

[0x000006a0]> e scr.prompt.f
[0x000006a0]> e scr.prompt.f[2K
[2K

[0x000006a0]> e scr.prompt.fi
[0x000006a0]> e scr.prompt.fi[2K
[2K

[0x000006a0]> e scr.prompt.fil
[0x000006a0]> e scr.prompt.fil[2K
[2K

[0x000006a0]> e scr.prompt.file
[0x000006a0]> e scr.prompt.file[2K
[2K

[0x000006a0]> e scr.prompt.file=
[0x000006a0]> e scr.prompt.file=[2K
[2K

[0x000006a0]> e scr.prompt.file=t
[0x000006a0]> e scr.prompt.file=t[2K
[2K

[0x000006a0]> e scr.prompt.file=tr
[0x000006a0]> e scr.prompt.file=tr[2K
[2K

[0x000006a0]> e scr.prompt.file=tru
[0x000006a0]> e scr.prompt.file=tru[2K
[2K

[0x000006a0]> e scr.prompt.file=true
[0x000006a0]> e scr.prompt.file=true[2K

[0x000006a0]> e scr.prompt.file=true
[2K

[hello_world:0x000006a0]> 
[hello_world:0x000006a0]> [2K
[2K

[hello_world:0x000006a0]> e
[hello_world:0x000006a0]> e[2K
[2K

[hello_world:0x000006a0]> e 
[hello_world:0x000006a0]> e [2K
[2K

[hello_world:0x000006a0]> e s
[hello_world:0x000006a0]> e s[2K
[2K

[hello_world:0x000006a0]> e sc
[hello_world:0x000006a0]> e sc[2K
[2K

[hello_world:0x000006a0]> e scr
[hello_world:0x000006a0]> e scr[2K
[2K

[hello_world:0x000006a0]> e scr.
[hello_world:0x000006a0]> e scr.[2K
[2K

[hello_world:0x000006a0]> e scr.p
[hello_world:0x000006a0]> e scr.p[2K
[2K

[hello_world:0x000006a0]> e scr.pr
[hello_world:0x000006a0]> e scr.pr[2K
[2K

[hello_world:0x000006a0]> e scr.pro
[hello_world:0x000006a0]> e scr.pro[2K
[2K

[hello_world:0x000006a0]> e scr.prom
[hello_world:0x000006a0]> e scr.prom[2K
[2K

[hello_world:0x000006a0]> e scr.promp
[hello_world:0x000006a0]> e scr.promp[2K
[2K

[hello_world:0x000006a0]> e scr.prompt
[hello_world:0x000006a0]> e scr.prompt[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.
[hello_world:0x000006a0]> e scr.prompt.[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.f
[hello_world:0x000006a0]> e scr.prompt.f[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.fl
[hello_world:0x000006a0]> e scr.prompt.fl[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.fla
[hello_world:0x000006a0]> e scr.prompt.fla[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.flag
[hello_world:0x000006a0]> e scr.prompt.flag[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.flag=
[hello_world:0x000006a0]> e scr.prompt.flag=[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.flag=t
[hello_world:0x000006a0]> e scr.prompt.flag=t[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.flag=tr
[hello_world:0x000006a0]> e scr.prompt.flag=tr[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.flag=tru
[hello_world:0x000006a0]> e scr.prompt.flag=tru[2K
[2K

[hello_world:0x000006a0]> e scr.prompt.flag=true
[hello_world:0x000006a0]> e scr.prompt.flag=true[2K

[hello_world:0x000006a0]> e scr.prompt.flag=true
[2K

[hello_world:entry0:0x000006a0]> 
[hello_world:entry0:0x000006a0]> [2K
[2K

[hello_world:entry0:0x000006a0]> s
[hello_world:entry0:0x000006a0]> s[2K
[2K

[hello_world:entry0:0x000006a0]> sd
[hello_world:entry0:0x000006a0]> sd[2K
[2K

[hello_world:entry0:0x000006a0]> sd 
[hello_world:entry0:0x000006a0]> sd [2K
[2K

[hello_world:entry0:0x000006a0]> sd 1
[hello_world:entry0:0x000006a0]> sd 1[2K

[hello_world:entry0:0x000006a0]> sd 1
[2K

[hello_world:entry0 + 1:0x000006a1]> 
[hello_world:entry0 + 1:0x000006a1]> [2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e
[hello_world:entry0 + 1:0x000006a1]> e[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e 
[hello_world:entry0 + 1:0x000006a1]> e [2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e s
[hello_world:entry0 + 1:0x000006a1]> e s[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e sc
[hello_world:entry0 + 1:0x000006a1]> e sc[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr
[hello_world:entry0 + 1:0x000006a1]> e scr[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.
[hello_world:entry0 + 1:0x000006a1]> e scr.[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.p
[hello_world:entry0 + 1:0x000006a1]> e scr.p[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.pr
[hello_world:entry0 + 1:0x000006a1]> e scr.pr[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.pro
[hello_world:entry0 + 1:0x000006a1]> e scr.pro[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prom
[hello_world:entry0 + 1:0x000006a1]> e scr.prom[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.promp
[hello_world:entry0 + 1:0x000006a1]> e scr.promp[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.f
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.f[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.fl
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.fl[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.fla
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.fla[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.o
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.o[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.on
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.on[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.onl
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.onl[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=t
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=t[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=tr
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=tr[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=tru
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=tru[2K
[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=true
[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=true[2K

[hello_world:entry0 + 1:0x000006a1]> e scr.prompt.flag.only=true
[2K

[hello_world:entry0 + 1]> 
[hello_world:entry0 + 1]> [2K
[2K

[hello_world:entry0 + 1]> e
[hello_world:entry0 + 1]> e[2K
[2K

[hello_world:entry0 + 1]> e 
[hello_world:entry0 + 1]> e [2K
[2K

[hello_world:entry0 + 1]> e s
[hello_world:entry0 + 1]> e s[2K
[2K

[hello_world:entry0 + 1]> e sc
[hello_world:entry0 + 1]> e sc[2K
[2K

[hello_world:entry0 + 1]> e scr
[hello_world:entry0 + 1]> e scr[2K
[2K

[hello_world:entry0 + 1]> e scr.
[hello_world:entry0 + 1]> e scr.[2K
[2K

[hello_world:entry0 + 1]> e scr.p
[hello_world:entry0 + 1]> e scr.p[2K
[2K

[hello_world:entry0 + 1]> e scr.pr
[hello_world:entry0 + 1]> e scr.pr[2K
[2K

[hello_world:entry0 + 1]> e scr.pro
[hello_world:entry0 + 1]> e scr.pro[2K
[2K

[hello_world:entry0 + 1]> e scr.prom
[hello_world:entry0 + 1]> e scr.prom[2K
[2K

[hello_world:entry0 + 1]> e scr.promp
[hello_world:entry0 + 1]> e scr.promp[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt
[hello_world:entry0 + 1]> e scr.prompt[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.
[hello_world:entry0 + 1]> e scr.prompt.[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.s
[hello_world:entry0 + 1]> e scr.prompt.s[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.se
[hello_world:entry0 + 1]> e scr.prompt.se[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sec
[hello_world:entry0 + 1]> e scr.prompt.sec[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sect
[hello_world:entry0 + 1]> e scr.prompt.sect[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sect=
[hello_world:entry0 + 1]> e scr.prompt.sect=[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sect=t
[hello_world:entry0 + 1]> e scr.prompt.sect=t[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sect=tr
[hello_world:entry0 + 1]> e scr.prompt.sect=tr[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sect=tru
[hello_world:entry0 + 1]> e scr.prompt.sect=tru[2K
[2K

[hello_world:entry0 + 1]> e scr.prompt.sect=true
[hello_world:entry0 + 1]> e scr.prompt.sect=true[2K

[hello_world:entry0 + 1]> e scr.prompt.sect=true
[2K

[hello_world:.text:entry0 + 1]> 
[hello_world:.text:entry0 + 1]> [2K
[2K

[hello_world:.text:entry0 + 1]> q
[hello_world:.text:entry0 + 1]> q[2K

[hello_world:.text:entry0 + 1]> q
EOF
RUN

NAME=color prompt
FILE==
CMDS=!rizin -e cfg.fortunes=0 -e scr.color=1 -N -c "< \nq\n" =
EXPECT=<<EOF
[2K

[0m[33m[0x00000000]>[0m 
[33m[0x00000000]>[0m [2K

[33m[0x00000000]>[0m 
[2K

[0m[33m[0x00000000]>[0m 
[33m[0x00000000]>[0m [2K
[2K

[0m[33m[0x00000000]>[0m q
[33m[0x00000000]>[0m q[2K

[33m[0x00000000]>[0m q
EOF
RUN

NAME=read from stdin
FILE=--
CMDS=echo \r\n | rizin -N -e scr.color=0 -qc "px 16" -
EXPECT=<<EOF
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x00000000  0d0a 0aff ffff ffff ffff ffff ffff ffff  ................
EOF
RUN
