Fortran · 800 bytes Raw Blame History
1 program test_scaffold
2 use fgof_lineedit, only : default_prompt, init_lineedit, lineedit_state, reset_lineedit
3 implicit none
4
5 type(lineedit_state) :: editor
6
7 call init_lineedit(editor, default_prompt("line> "))
8 if (.not. editor%active) error stop "editor should start active"
9 if (editor%prompt%text /= "line> ") error stop "editor should preserve prompt text"
10 if (editor%buffer /= "") error stop "editor should start with an empty buffer"
11 if (editor%cursor /= 1) error stop "editor should start with cursor at 1"
12
13 call reset_lineedit(editor)
14 if (editor%active) error stop "reset should deactivate the editor"
15 if (editor%buffer /= "") error stop "reset should clear the buffer"
16 if (editor%cursor /= 1) error stop "reset should restore cursor position"
17 end program test_scaffold
18