diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-04-13 12:46:01 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-04-13 12:46:01 +0800 |
commit | a223ffb9d0629e8b498f07dc67f056a7fb95385e (patch) | |
tree | 2e0f8dd5110e282bd31a071e7060e6d56651269b /src/expand/test.cpp | |
parent | 9ee40f479d9b655fefcd45bd10691473d23cf0f0 (diff) | |
download | mrust-a223ffb9d0629e8b498f07dc67f056a7fb95385e.tar.gz |
All - Add rough support for #[test] (runs basic tests)
Diffstat (limited to 'src/expand/test.cpp')
-rw-r--r-- | src/expand/test.cpp | 14 |
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({}); + } } }; |