Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pseudo-mod TEST_DATA folder and auto-load it #38945

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions data/mods/TEST_DATA/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Test Data pseudo-mod #

This mod is purely for loading data to be used by `tests/cata_test`. It is
automatically loaded by `tests/test_main.cpp`, so any items, recipes, or other
content defined in the mod will be available to everything in `tests/`.

The benefit of using this mod for test data is that it allows a clean
separation of tests from in-game content. Instead of testing with content in
the main `data/json` directory, functional tests can use `TEST_DATA` content
to ensure a more stable and controllable set of example data.

12 changes: 12 additions & 0 deletions data/mods/TEST_DATA/modinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"type": "MOD_INFO",
"ident": "test_data",
"name": "TESTING DATA",
"description": "Adds mockup items, recipes, and other content for use by automated tests.",
"category": "content",
"//": "Not really obsolete! Marked as such to prevent it from showing in the main list",
"obsolete": true,
"dependencies": [ "dda" ]
}
]
3 changes: 3 additions & 0 deletions tests/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ static std::vector<mod_id> extract_mod_selection( std::vector<const char *> &arg
ret.emplace_back( mod_name );
}
}
// Always load test data mod
ret.emplace_back( "test_data" );

return ret;
}

Expand Down