primitives for writing tests
[?]
Apr 12, 2023, 4:33 AM
HXH4AIF2YG5QYNJEDZOSJLFTMWSDERW7XJBQX5ZDQ2TXM222TXYQCDependencies
- [2]
N2NUGNN4include a brief reference enabling many useful apps - [3]
AD34IX2Zcouple more tests - [4]
KKMFQDR4editing source code from within the app - [5]
AVTNUQYRbasic test-enabled framework - [*]
3QNOKBFMbeginnings of a test harness
Change contents
- edit in reference.md at line 314[2.12596]
### writing tests* `App.screen.init{width=.., height=..}` -- creates a fake screen for a test* `App.screen.check(y, expected_contents, msg)` -- verifies text written tothe fake screen at `y`. This isn't very realistic; `y` must exactly matchwhat was displayed, and the expected contents show everything printed tothat `y` in chronological order, regardless of `x` coordinate. In spite ofthese limitations, you can write lots of useful tests with this.* `App.run_after_textinput(t)` -- mimics keystrokes resulting in `t` and thendraws one frame.* `App.run_after_keychord(chord)` -- mimics keystrokes resulting in `chord`and then draws one frame.* `App.run_after_mouse_press(x,y, mouse_button)` -- mimics a mouse press downfollowed by drawing a frame.* `App.run_after_mouse_release(x,y, mouse_button)` -- mimics a mouse releaseup followed by drawing a frame.* `App.run_after_mouse_click(x,y, mouse_button)` -- mimics a mouse press downand mouse release up followed by drawing a frame.* `App.wait_fake_time(t)` -- simulates the passage of time for `App.getTime()`. - replacement in app.lua at line 148
App.screen.init({width=100, height=50})App.screen.init{width=100, height=50}