summaryrefslogtreecommitdiff
path: root/src/ast
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-04-13 12:46:01 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-04-13 12:46:01 +0800
commita223ffb9d0629e8b498f07dc67f056a7fb95385e (patch)
tree2e0f8dd5110e282bd31a071e7060e6d56651269b /src/ast
parent9ee40f479d9b655fefcd45bd10691473d23cf0f0 (diff)
downloadmrust-a223ffb9d0629e8b498f07dc67f056a7fb95385e.tar.gz
All - Add rough support for #[test] (runs basic tests)
Diffstat (limited to 'src/ast')
-rw-r--r--src/ast/crate.hpp21
1 files changed, 21 insertions, 0 deletions
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<TestDesc> m_tests;
+
enum class Type {
Unknown,
RustLib,