summaryrefslogtreecommitdiff
path: root/src/expand/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/expand/test.cpp')
-rw-r--r--src/expand/test.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/expand/test.cpp b/src/expand/test.cpp
index fba6556f..26639203 100644
--- a/src/expand/test.cpp
+++ b/src/expand/test.cpp
@@ -7,6 +7,7 @@
*/
#include <synext_decorator.hpp>
#include <ast/ast.hpp>
+#include <ast/crate.hpp>
class CTestHandler:
public ExpandDecorator
@@ -18,8 +19,17 @@ class CTestHandler:
ERROR(sp, E0000, "#[test] can only be put on functions - found on " << i.tag_str());
}
- // TODO: Proper #[test] support, for now just remove them
- i = AST::Item::make_None({});
+ if( crate.m_test_harness )
+ {
+ ::AST::TestDesc td;
+ td.name = path.nodes().back().name();
+ td.path = ::AST::Path(path);
+ crate.m_tests.push_back( mv$(td) );
+ }
+ else
+ {
+ i = AST::Item::make_None({});
+ }
}
};