Commit Graph

168 Commits (c1b9de87d2303acecd763d71c020d70046049dc8)

Author SHA1 Message Date
myk002 c23970f36b add unit tests 2021-09-20 16:10:15 -07:00
myk002 8c8365abec only run dig-now over the test area 2021-09-17 10:57:26 -07:00
myk002 44a93fcb28 update unit tests 2021-09-17 10:57:26 -07:00
myk002 772e386427 implement --format option for minimal and pretty
pretty is currently equivalent to the previous format, though there will
be changes in the future
2021-09-17 10:57:26 -07:00
myk002 0747f872b0 add --splitby param to blueprint
--splitby=none is the new default, allowing all blueprint phases to be
written to a single file. old behavior of one phase per file is
supported via --splitby=phase.
2021-09-09 09:58:53 -07:00
lethosor d5be63823d
Merge remote-tracking branch 'TymurGubayev/patch-1' into develop 2021-08-31 00:55:36 -04:00
myk002 39a8f2c799 migrate existing tests to use expect.str_find() 2021-08-25 06:38:22 -07:00
myk002 9168f9359d
name test method the same as the method under test 2021-08-24 21:29:32 -07:00
myk002 691e54dfc6
rename expect.find to expect.str_find 2021-08-24 21:06:12 -07:00
myk002 b2f44f00f1
add pattern matching expect.find() for unit tests
settled on `find()` since the string method of the same name has the
same semantics. other options: `str_find()` since it fails on non-string
or `match()` (but that might imply that the pattern needs to match the
entire string).
2021-08-23 22:59:30 -07:00
lethosor 3a27a5d6a0
Allow dialog tests to run outside of fortress mode 2021-08-22 17:45:45 -04:00
myk002 86b2329b7f
fix hardcoded call to pairs, add test 2021-08-20 22:55:07 -07:00
myk002 119595dcaf
use df.item._identity to test noniterable userdata 2021-08-19 21:57:16 -07:00
myk002 0f0ae156c3
test printall_recurse 2021-08-19 21:57:16 -07:00
myk002 c5bb139282
unit test with userdata 2021-08-19 21:57:16 -07:00
myk002 d9c6c2dde3
add safe_pairs, update unit tests 2021-08-19 21:57:16 -07:00
myk002 3f2795e80a
unit tests first draft 2021-08-19 21:56:44 -07:00
myk002 f47bab9806
pass comment param to expect calls 2021-08-14 16:43:40 -07:00
myk002 9a7a692ea8
ensure restored orders start at index 0
so the manager_order_next_id state can be set to #orders
2021-08-14 16:35:41 -07:00
myk002 9ec1488f1b
add unit tests 2021-08-14 16:35:40 -07:00
myk002 98b707d444
ensure active orders are restored after tests 2021-08-14 16:35:40 -07:00
Timur Kelman 4c2473de92
add test.ListBox_with_multi_select_and_visual_indicator
this test also demonstrates actual (minimal) example usage
2021-07-31 11:46:59 +02:00
Timur Kelman 4bf8b6daab
fix tabs and whitespaces 2021-07-30 23:23:58 +02:00
Timur Kelman 70d088c763
add tests for dialog.lua 2021-07-30 23:21:35 +02:00
myk002 a34e1e986d
quickfort orders is now safe to include directly 2021-07-09 22:02:15 -07:00
myk002 8fe173299c
update header comment 2021-07-09 22:02:15 -07:00
myk002 551a5cba4b
optimize test area search 2021-07-09 22:02:15 -07:00
myk002 232c85d258
use lua to blueprint to avoid console spam 2021-07-09 22:02:15 -07:00
myk002 0e270a3505
be sure to reset border tiles between tests 2021-07-09 22:02:15 -07:00
myk002 c2b92ce6a0
use new dig-now and tiletypes-here APIs 2021-07-09 22:02:15 -07:00
myk002 21a4f64cdd
ensure test loads when game is not in fort mode
even if the test is not being run
2021-07-09 22:02:14 -07:00
myk002 73413038df
add quickfort ecosystem functional test harness
and a few initial tests
2021-07-09 22:02:14 -07:00
lethosor 1014c41db6
Add context to some loops in tests 2021-07-05 20:49:25 -04:00
lethosor 898d4621da
Merge remote-tracking branch 'myk002/myk_view_unit' into develop 2021-07-05 20:42:49 -04:00
myk002 f1bcf0c7b5
make dwarfmode test not require autocorrection 2021-07-05 16:05:12 -07:00
myk002 4eb8870797
add unit tests 2021-07-05 16:02:19 -07:00
myk002 5e0672902c
fix parse_gui_commandline test when run on title 2021-07-05 16:01:23 -07:00
myk002 0ef5134a33
add optional coordinate validation to coords 2021-07-04 07:32:29 -07:00
myk002 56a1c8b4d5
coordinates can be 0 2021-07-03 16:26:39 -07:00
myk002 aefb893daa
remove redundant tests 2021-07-02 23:29:02 -07:00
myk002 9535ff82bb
add argparse library functions 2021-07-02 23:11:17 -07:00
lethosor f9627a0cfb
Add another split() test for pattern delimiters 2021-07-03 00:33:28 -04:00
lethosor da3b522061
Enable string.split() tests
Ref #1888 (step 4)
2021-07-03 00:31:19 -04:00
myk002 36b2d05ff6
add dfhack string functions and tests
added string:split
added string:trim
added a default value for wrap width
added function comments
added tests for all string functions (the tests for string:split will be commented out until we remove the competing implementation in gui/load-screen
2021-07-02 13:21:54 -07:00
lethosor 3a7306eb03
Restrict orders tests to fortress mode 2021-06-30 23:18:53 -04:00
lethosor 75bf013c7f
Add more "orders import" tests
The invalid-after-valid test fails
2021-06-30 23:15:56 -04:00
lethosor 5686272c91
Add tests for "orders import"
A couple crashes have resulted from invalid orders JSON files - this should
help catch any regressions with error handling.

See #1770, #1893, #1894
2021-06-30 23:01:51 -04:00
myk002 eafa6e86f7
add utils.normalizePath() 2021-06-29 12:22:05 -07:00
lethosor e070f4d9d8
Merge remote-tracking branch 'myk002/myk_sidebar' into develop 2021-06-28 01:03:13 -04:00
lethosor 4945018e92
Merge remote-tracking branch 'myk002/myk_multi_mock' into develop 2021-06-25 01:27:46 -04:00
lethosor 0297a5b1b8
Check some more cases, especially empty strings 2021-06-24 00:42:50 -04:00
myk002 5b12c64cba
add new string function: wrap()
refactored and improved from the implementation in quickfort's dialog.lua
2021-06-23 13:59:39 -07:00
myk002 000b589e3a
add dwarfmode library function: enterSidebarMode()
refactored from quickfort. this common implementation will replace the
now redundant functions in quickfort, gui/mass-remove, and gui/blueprint
2021-06-23 12:29:37 -07:00
myk002 b7a970a309
allow mock.func() to return multiple values 2021-06-15 13:16:05 -07:00
myk002 1b1b4245c9
report output filenames when creating blueprints
also refactor so we can get this data from gui/blueprint
2021-05-31 15:34:19 -07:00
myk002 1aaed3a6ed
error on invalid phase names 2021-05-21 06:34:28 -07:00
myk002 95d97b929e
remove unit tests for removed function 2021-05-15 05:59:37 -07:00
myk002 816cd5cf27
add unit tests 2021-05-10 21:11:13 -07:00
Myk 654b3e9c56
Merge branch 'develop' into myk_negative_number_params 2021-05-09 21:46:07 -07:00
lethosor 4968d97c22
test/structures/find: avoid overwriting other potential config values 2021-05-08 22:12:07 -04:00
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 403f822520
Add tests for patch() where patching raises an error 2021-04-17 00:59:56 -04: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 757dbeb238
update existing calls to expect.error* to new API 2021-04-04 17:37:36 -07:00
Ben Lubar c06d1f8e52
tagged union support for lua (#1818) 2021-03-30 15:55:06 -05: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
lethosor 29a396ba54
Merge branch 'develop' into myk_move_main 2021-03-23 22:17:36 -04:00
lethosor 9a29e5f1ce
Make "test file failed to load" errors more obvious, and make run-tests.py fail
These errors could previously go undetected, since they were easy to miss at the
end of the output and did not cause run-tests.py to fail.

This change adds a `*` pseudo-entry to test_status.json, which is set to
"failed" if any tests failed *or* failed to load. This avoids the need to change
run-tests.py, which is cached on Buildmaster.

See #1815
2021-03-23 22:11:48 -04:00
lethosor e9efa6c961
Update xml, fix + improve robustness of unions.lua unit tests
- unit_action_fields(): handled primitive union members correctly
- unit_action_type(): added messages to make failures easier to diagnose
    - Also removed redundant checks that effectively checked that
      `enum.attrs[k] == enum.attrs[v]` - this is out of scope of union tests
2021-03-23 21:24:57 -04:00
myk002 5f00183177
move test harness out of test dir
and install to test.lua in top-level scripts directory instead of test/main.lua
2021-03-22 10:15:32 -07:00
myk002 3e5a2c8d7c
rerun all tests by default
introduce and use --resume option for ci
2021-03-22 10:06:03 -07:00
lethosor 120a359d6f
Fix typo 2021-03-20 13:29:30 -04:00
myk002 403ba2b8ea
work when there is no done_command 2021-03-07 12:06:48 -08:00
myk002 98b67e170d
allow done_command to be set in test_config.json 2021-03-07 08:51:02 -08:00
myk002 dc5fe71caf
add more help and improve compatibility
- explain modes, done command, and test_config.json file format
- also be more flexible with how the done command is formatted (can now be
  passed as either separate tokens or as a single quoted string)
- print the filter values when filtering tests
2021-03-07 08:24:18 -08:00
myk002 3ff3457c10
include main test file as a module for testing
rewrite main.lua so it can be included as a module
rename test.lua to test_test.lua since I plan to rename main.lua to
test.lua in a future PR
2021-03-07 08:24:18 -08:00
myk002 4779dd678d
fix test_dir param and allow userdata in table_eq 2021-03-07 08:24:18 -08:00
myk002 6a95308123
support setting test_dir on the commandline 2021-03-07 08:24:18 -08:00
myk002 f176310bcd
make table_eq check recursive equality
and add tests. to write test the table_eq function itself, I expose it
in the text env via expect_raw. if we don't want to do this,
alternatives could be:
1. add the test to main.lua itself
2. expose the expect.table_eq function via a test_hooks variable. then
   test.lua could require main.lua and access the function via the hook.
   may need to update main.lua a bit to ensure it does not run when it
   is "require"d
2021-03-07 08:24:17 -08:00
myk002 b302289864
prep test/main.lua for running live unit tests
- make test config controllable via commandline params
- enable filtering by mode
- fix test filter code (it would misbehave if multiple filters were
  specified)
- allow done_command to have multiple tokens (before it could only be
  one word)
- remove preemptive check for the title screen. it is still checked when a
  test actually requires that the game is on the title screen
2021-03-07 08:24:17 -08:00
lethosor 371314d9c3
Update scripts, tweak test 2020-12-16 13:16:13 -05:00
lethosor d437cfe649
Add test for invalid job types in workflow's job_outputs 2020-12-15 21:36:57 -05:00
lethosor bd92d8f27a
Make require() reload modules when run in tests 2020-12-15 21:27:21 -05:00
lethosor d3aeca495f
Set dfhack.internal.IN_TEST flag when running tests 2020-12-15 21:27:19 -05:00
lethosor b55d844164
Add test for get_initial_cwd() 2020-11-12 21:03:05 -05:00
lethosor 9c8098b4f0
Expose to_search_normalized to Lua, add test, and use in ListColumn (most useful for the `stocks` plugin) 2020-10-10 01:40:00 -04:00
lethosor f0ad730a37
Lua: Fix off-by-one preventing accessing last df-other-vectors item by ID, add tests 2020-07-26 02:11:27 -04:00
lethosor 4891b4fd5e
Fix indexing primitive refs with integers (broken in #1543), add tests
Apparently lua_tostring has the side effect of *converting* numbers to strings
2020-07-25 20:22:52 -04:00
lethosor 56e43a0dde
Linux: make Process::getPath (and dfhack.getDFPath()) not depend on cwd, for consistency with other platforms 2020-07-16 23:21:56 -04:00
lethosor 1f1bb5a055 Update Lua API docs for ref_target field, add tests 2020-07-14 02:57:30 -04:00
lethosor 498eb2750b +Tests 2020-04-06 19:28:34 -04:00
lethosor d664681ea8 Add a basic test for df.image_set.find() 2020-04-05 23:30:24 -04:00