Commit Graph

293 Commits (a7a5a48c7aab2ec2b2659781de4c10d549fed11b)

Author SHA1 Message Date
myk002 59b08e99f6
fix -- handling and required arg detection 2021-05-07 15:21:45 -07:00
myk002 fd735d4b42
treat negative numbers as non-options in getopt 2021-05-07 15:21:45 -07:00
lethosor ee8e10429d
Add initial implementation of mock.restore()
Like mock.patch() but only restores original values instead of also setting
new values initially.
2021-04-16 00:34:46 -04:00
lethosor 757736728d
Add a mock.func() helper for mocking functions 2021-04-10 01:22:03 -04:00
lethosor 5424392273
mock.patch(): propagate return values 2021-04-09 00:41:39 -04:00
lethosor f25b8a0d14
Fix patching value with nil 2021-04-09 00:35:54 -04:00
lethosor 7b2f01d45b
Add initial mock.patch() implementation for tests 2021-04-09 00:32:10 -04:00
myk002 642d8cbe4b
handle nil values sent to printerr 2021-04-05 01:37:43 -07:00
myk002 13ca7f8c9e
move expect.lua from internal/ to test_util/ 2021-04-04 17:37:37 -07:00
myk002 5af1b627cb
add tests, move expect.lua
I moved expect.lua from library/lua/test/ to library/lua/internal since
luacov is configured to ignore any file with /test/ in its path
2021-04-04 17:37:36 -07:00
myk002 a6561911c1
error on unmatched printerr output during a test
- provides expect,printerr_match for matching printerr output
- fails tests if printerr is called outside the printerr_match wrapper
- changes api of expect.error_match to mirror the new printerr_match api
2021-04-04 17:37:33 -07:00
myk002 4e844f39ae
undo formatting change in script_environment 2021-03-29 12:29:15 -07:00
myk002 54a1e8d98a
move script_environment changes to test.lua 2021-03-29 12:23:53 -07:00
myk002 e4cab1b1c6
load scripts into different namespace for testing 2021-03-29 11:26:28 -07:00
lethosor 2332009825
Merge remote-tracking branch 'myk002/myk_enable_luacov' into develop 2021-03-28 00:38:36 -04:00
lethosor 5e09fd882d
Fix Painter:viewport()
This works because Painter inherits from ViewRect. Unsure how this went unnoticed.
2021-03-27 16:55:48 -04:00
lethosor 62776f5568
Move `expect` functions to a separate file
This allows tests to test these functions without needing to include the test
wrapper directly (now ci/test.lua, formerly test/main.lua). Hopefully this
location is also more stable, similar to other libraries that are already tested.
2021-03-24 00:48:52 -04:00
myk002 754baa45b3
remove io overrides
they were causing side effects when writing luacov reports
2021-03-07 08:16:24 -08:00
myk002 ba6a02eb59
call luacov.runner.init directly and clean up dbg 2021-03-07 08:16:24 -08:00
myk002 418a8c5d21
propagate luacov debug hook through coroutines 2021-03-07 08:16:24 -08:00
lethosor 7e12f3fd3d
Fix off-by-one, adjust changelog, move scroll keys to consistent place
Ref #1748
2021-01-30 19:40:15 -05:00
lethosor 8967e98a33
Merge remote-tracking branch 'myk002/myk_scrollable_labels' into develop 2021-01-30 19:33:04 -05:00
lethosor 4126585573
Merge remote-tracking branch 'lethosor/lua-runcommand' into develop 2021-01-29 20:27:38 -05:00
lethosor de6f9183fd
Fix changelog, replace a couple qerror calls with error
Ref #1746
2021-01-29 00:04:10 -05:00
myk002 5a2181d55e
don't render overflow text 2021-01-13 22:02:22 -08:00
myk002 39d274b00e
address review comments 2021-01-12 23:42:53 -08:00
myk002 d4fbf4261f
address review comments 2021-01-12 23:27:14 -08:00
myk002 dac9538fd9
let navigation keys propagate
so other components can use them for simultaneous control
2021-01-11 15:02:12 -08:00
Myk Taylor 2797061b04
scroll Label text when height exceeds viewrect 2021-01-11 14:47:05 -08:00
Myk Taylor 175776812e
implement a nice API wrapper for getopt 2021-01-10 16:51:46 -08:00
Myk Taylor 3b45878d41
allow non-options in commandlines and return them
also call qerror() on error, not os.exit
2021-01-10 16:51:45 -08:00
Myk Taylor 20276be50f
check in unaltered version of alt_getopt 2021-01-10 16:51:45 -08:00
lethosor 614ea739d0
Merge branch 'develop' into lua-runcommand 2021-01-08 20:45:23 -05:00
myk002 3ba984c22c
only reset extents if they are unusable
this allows callers of Buildings::setSize() to "pre-initialize" the
extents to declare non-rectangular structures. this allows quickfort to
create non-rectangular stockpiles, farm plots, zones, etc. the extents
are still reset as before if the size of the building doesn't match the
caller's expectations.

this commit also fixes a memory leak when setSize() allocates memory for
extents, but the memory is not deallocated if the building is ultimately
invalid for some reason.
2020-12-16 11:10:47 -08:00
lethosor a9bb11c145
Optimize Lua's internal.runCommand() when printing directly to the console
This also makes commands run with `run_command()` detect the console properly (notably used by `df2console()`)
2020-11-20 17:57:54 -05:00
lethosor fb44b26b47
Make utils.addressof() work for raw userdata 2020-11-19 21:32:42 -05:00
Myk Taylor 186f28a94b filters for altars, display cases, and bookcases 2020-10-23 09:11:07 -07:00
Myk Taylor 3c51bb51ab remove references to non-existent vector ids 2020-09-28 23:14:13 -07:00
Myk Taylor 6cc1428199 Merge remote-tracking branch 'upstream/develop' into buildings_vectors 2020-09-28 23:13:13 -07:00
lethosor dfac5bc143
Update gui.Painter docs, add sections to dfhack.screen, add more links, etc 2020-09-23 22:00:39 -04:00
Myk Taylor f837532b42 use more precise item vectors for bld item filters 2020-09-13 17:12:29 -07:00
lethosor 3b5a82cc05
Change color of ListBox.select2_hint to grey to indicate enabled
Ref dfhack/scripts#185
2020-08-27 00:08:28 -04:00
lethosor c034276af5
Merge remote-tracking branch 'myk002/quickfort_filter' into develop 2020-08-21 00:34:34 -04:00
Myk Taylor 9a3e9d5b12 listbox filter can match strings after punctuation 2020-08-17 21:15:33 -07:00
Myk Taylor 8a438c2a55 allow row_height to be set from the ListBox class 2020-08-17 21:14:05 -07:00
nicolasayala 141928ead0 Fix gui.FilteredList widget search on plain string choices 2020-02-27 07:56:30 +01:00
Timur Kelman 1d8998de22
allow custom filter in `dfhack.printall_recurse`
Objects with links like `job` output way too much. With this change, it's possible to provide an optional filter and exclude the `list_link`.
```
[lua]# j = dfhack.gui.getSelectedJob()
[lua]# printall_recurse(j, {[tostring(j.list_link)]=true, [tostring(j.pos)]=true})
```
2020-02-23 16:57:57 +01:00
Ben Lubar 96d8dffd32
Make dfhack.run_command return the command_result value.
Rename local variables to match dfhack.run_command_silent for clarity.
2020-01-14 17:53:52 -06:00
lethosor 49563b4618 Merge remote-tracking branch 'warmist/FilteredListFix' into develop 2019-11-02 16:28:06 -04:00
Warmist a2b5c1ddd9
lua/widgets filtered list input fix
FilteredList was not consuming input events.
2019-09-30 22:00:06 +03:00