Merge lines.love
[?]
Sep 7, 2022, 5:18 PM
SBCRTDXCUKVH2W67BU6SYDMFU6NDI3W5R3OILKGICETU43CITY6ACDependencies
- [2]
LXW73CJ3Merge lines.love - [3]
2WGHUWE6self-documenting 0 Test_right_margin - [4]
CE4LZV4Tdrop last couple of manual tests - [5]
27DROQW2Merge upstream into main - [6]
7YVCOPLEMerge upstream into main - [7]
5BJCYYHNconvert videos to gif so they render inline on GitHub - [8]
BLWAYPKVextract a module - [9]
FS2ITYYHrecord a known issue - [10]
V366JSXAvideos - [11]
7CEOB56DMerge upstream into main - [12]
X7IHIK6NMerge upstream into main - [13]
V7LATJC7bugfix: resize - [14]
73OCE2MCafter much struggle, a brute-force undo - [15]
4YDBYBA4clean up memory leak experiments - [16]
R5QXEHUIsomebody stop me - [17]
VHQCNMARseveral more modules - [18]
TLOAPLBJadd a license - [19]
CNCYMM6Amake test initializations a little more obvious - [20]
AVTNUQYRbasic test-enabled framework - [21]
VXORMHMEdelete experimental REPL - [22]
XX7G2FFJintermingle freehand line drawings with text - [23]
RSZD5A7Gforgot to add json.lua - [24]
BULPIBEGbeginnings of a module for the text editor - [25]
TVCPXAAUrename - [26]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [27]
OEUU62GMMerge upstream into main - [28]
3QNOKBFMbeginnings of a test harness - [29]
OGUV4HSAremove some memory leaks from rendered fragments - [30]
7M5PGWKUdrop last couple of manual tests - [31]
2L5MEZV3experiment: new edit namespace - [32]
LXTTOB33extract a couple of files - [33]
K2X6G75Zstart writing some tests for drawings - [34]
6LJZN727handle chords - [35]
VUVH2XLFMerge upstream into main - [36]
OTIBCAUJlove2d scaffold - [37]
KMSL74GAsupport selections in the source editor - [38]
7XKWT5Y5correct location of the line width slider - [39]
T4FRZSYLdelete an ancient, unused file - [40]
6SMDSWQ2Merge lines.love - [41]
D2GCFTTTclean up repl functionality - [42]
KKMFQDR4editing source code from within the app - [43]
66X36NZNa little more prose describing manual_tests
Change contents
- file deletion: run_tests.lua main_tests.lua
function test_resize_window()io.write('\ntest_resize_window')check_eq(App.screen.height, 300, 'F - test_resize_window/baseline/height')App.resize(200, 400)check_eq(App.screen.width, 200, 'F - test_resize_window/width')check_eq(App.screen.height, 400, 'F - test_resize_window/height')check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin')check_eq(Editor_state.width, 200-Test_margin_left-Margin_right, 'F - test_resize_window/drawing_width')-- TODO: how to make assertions about when App.update got past the early exit?endendfunction test_drop_file()io.write('\ntest_drop_file')App.filesystem['foo'] = 'abc\ndef\nghi\n'local fake_dropped_file = {opened = false,getFilename = function(self)return 'foo'end,open = function(self)self.opened = trueend,lines = function(self)assert(self.opened)return App.filesystem['foo']:gmatch('[^\n]+')end,close = function(self)self.opened = falseend,}App.filedropped(fake_dropped_file)endfunction test_drop_file_saves_previous()io.write('\ntest_drop_file_saves_previous')-- initially editing a file called foo that hasn't been saved to filesystem yet-- now drag a new file bar from the filesystemApp.filesystem['bar'] = 'abc\ndef\nghi\n'local fake_dropped_file = {opened = false,getFilename = function(self)return 'bar'end,open = function(self)self.opened = trueend,lines = function(self)assert(self.opened)return App.filesystem['bar']:gmatch('[^\n]+')end,close = function(self)self.opened = falseend,}App.filedropped(fake_dropped_file)-- filesystem now contains a file called foocheck_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')Editor_state.lines = load_array{'abc', 'def'}Editor_state.filename = 'foo'schedule_save(Editor_state)App.screen.init{width=Editor_state.left+300, height=300}check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')edit.draw(Editor_state)App.screen.init{width=Editor_state.left+300, height=300}Editor_state = edit.initialize_test_state()check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/left_margin')-- ugly; right margin switches from 0 after resizecheck_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/baseline/left_margin')Editor_state.filename = 'foo'check_eq(App.screen.width, 300, 'F - test_resize_window/baseline/width')App.screen.init{width=300, height=300}Editor_state = edit.initialize_test_state() - file un-deletion: run_tests.lua run_tests.lua
- resurrect zombie in run_tests.lua at line 1[4.4513]→[3.562:665](∅→∅),[4.4513]→[3.562:665](∅→∅),[4.4513]→[3.562:665](∅→∅),[4.332]→[3.666:719](∅→∅),[4.332]→[3.666:719](∅→∅),[4.466]→[3.720:801](∅→∅),[4.466]→[3.720:801](∅→∅),[4.466]→[3.720:801](∅→∅),[4.489]→[3.802:903](∅→∅),[4.489]→[3.802:903](∅→∅),[4.489]→[3.802:903](∅→∅)
check_eq(Editor_state.right, 300 - Test_margin_right, 'F - test_resize_window/baseline/left_margin')-- ugly; resize switches to real, non-test marginscheck_eq(Editor_state.left, Margin_left, 'F - test_resize_window/left_margin')check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'F - test_resize_window/drawing_width') - edit in run_tests.lua at line 1
function test_resize_window()io.write('\ntest_resize_window')App.screen.init{width=300, height=300}Editor_state = edit.initialize_test_state()Editor_state.filename = 'foo'check_eq(App.screen.width, 300, 'F - test_resize_window/baseline/width')check_eq(App.screen.height, 300, 'F - test_resize_window/baseline/height')check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/baseline/left_margin') - edit in run_tests.lua at line 10
App.resize(200, 400) - edit in run_tests.lua at line 12
check_eq(App.screen.width, 200, 'F - test_resize_window/width')check_eq(App.screen.height, 400, 'F - test_resize_window/height') - edit in run_tests.lua at line 15
check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin') - edit in run_tests.lua at line 17[3.903]
-- TODO: how to make assertions about when App.update got past the early exit?endfunction test_drop_file()io.write('\ntest_drop_file')App.screen.init{width=Editor_state.left+300, height=300}Editor_state = edit.initialize_test_state()App.filesystem['foo'] = 'abc\ndef\nghi\n'local fake_dropped_file = {opened = false,getFilename = function(self)return 'foo'end,open = function(self)self.opened = trueend,lines = function(self)assert(self.opened)return App.filesystem['foo']:gmatch('[^\n]+')end,close = function(self)self.opened = falseend,}App.filedropped(fake_dropped_file)check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')edit.draw(Editor_state)endfunction test_drop_file_saves_previous()io.write('\ntest_drop_file_saves_previous')App.screen.init{width=Editor_state.left+300, height=300}-- initially editing a file called foo that hasn't been saved to filesystem yetEditor_state.lines = load_array{'abc', 'def'}Editor_state.filename = 'foo'schedule_save(Editor_state)-- now drag a new file bar from the filesystemApp.filesystem['bar'] = 'abc\ndef\nghi\n'local fake_dropped_file = {opened = false,getFilename = function(self)return 'bar'end,open = function(self)self.opened = trueend,lines = function(self)assert(self.opened)return App.filesystem['bar']:gmatch('[^\n]+')end,close = function(self)self.opened = falseend,}App.filedropped(fake_dropped_file)-- filesystem now contains a file called foocheck_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')end