From a223ffb9d0629e8b498f07dc67f056a7fb95385e Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 13 Apr 2017 12:46:01 +0800 Subject: All - Add rough support for #[test] (runs basic tests) --- src/ast/crate.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/ast/crate.hpp') diff --git a/src/ast/crate.hpp b/src/ast/crate.hpp index b74012a3..f9594a83 100644 --- a/src/ast/crate.hpp +++ b/src/ast/crate.hpp @@ -10,6 +10,23 @@ namespace AST { class ExternCrate; +class TestDesc +{ +public: + ::AST::Path path; + ::std::string name; + bool ignore = false; + bool is_benchmark = false; + + enum class ShouldPanic { + No, + Yes, + YesWithMessage, + } panic_type = ShouldPanic::No; + + ::std::string expected_panic_message; +}; + class Crate { public: @@ -22,6 +39,10 @@ public: // Mapping filled by searching for (?visible) macros with is_pub=true ::std::map< ::std::string, const MacroRules*> m_exported_macros; + // List of tests (populated in expand if --test is passed) + bool m_test_harness = false; + ::std::vector m_tests; + enum class Type { Unknown, RustLib, -- cgit v1.2.3