mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
test: Make description pragma mandatory (#251)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#pragma description TODO
|
||||
|
||||
import std.math;
|
||||
import std.core;
|
||||
import type.magic;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma description TODO
|
||||
|
||||
import std.mem;
|
||||
import std.io;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma description TODO
|
||||
|
||||
import std.mem;
|
||||
import std.io;
|
||||
import std.string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma author Fl3ch4
|
||||
|
||||
#pragma description TODO
|
||||
#pragma MIME image/webp
|
||||
#pragma endian big
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma description TODO
|
||||
|
||||
import std.core;
|
||||
import std.io;
|
||||
import std.mem;
|
||||
|
||||
@@ -39,8 +39,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Setup Pattern Language Runtime
|
||||
pl::PatternLanguage runtime;
|
||||
bool hasDescription = false;
|
||||
{
|
||||
constexpr auto DummyPragmaHandler = [](const auto&, const auto&){ return true; };
|
||||
auto DescPragmaHandler = [&hasDescription](const auto&, const auto&){
|
||||
hasDescription = true;
|
||||
return true;
|
||||
};
|
||||
|
||||
runtime.setDataSource(0x00, testFile.getSize(),
|
||||
[&](pl::u64 address, pl::u8 *data, size_t size) {
|
||||
@@ -51,6 +56,7 @@ int main(int argc, char **argv) {
|
||||
runtime.setDangerousFunctionCallHandler([]{ return true; });
|
||||
runtime.setIncludePaths({ includePath });
|
||||
runtime.addPragma("MIME", DummyPragmaHandler);
|
||||
runtime.addPragma("description", DescPragmaHandler);
|
||||
runtime.addDefine("__PL_UNIT_TESTS__");
|
||||
|
||||
runtime.setLogCallback([](auto level, const std::string &message) {
|
||||
@@ -77,5 +83,5 @@ int main(int argc, char **argv) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return hasDescription ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user