Commit Graph

75 Commits (d391d7003a67fd73950237ebc67e18ee5092833c)

Author SHA1 Message Date
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