From 096b10b96162eca90958af42e24520e2bc728494 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 21 Oct 2016 11:25:15 +0200 Subject: Add notion of testscript test and group scopes --- build2/test/script/script | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'build2/test/script/script') diff --git a/build2/test/script/script b/build2/test/script/script index a847e2b..860e5d4 100644 --- a/build2/test/script/script +++ b/build2/test/script/script @@ -32,6 +32,8 @@ namespace build2 replay_tokens tokens; }; + using lines = vector; + // Parse object model. // enum class redirect_type @@ -101,17 +103,13 @@ namespace build2 ostream& operator<< (ostream&, const command&); - struct test: command {}; - class scope { public: scope* parent; // NULL for the root (script) scope. - scope (scope& p): parent (&p) {} - - protected: - scope (): parent (nullptr) {} // For the root (script) scope. + lines setup; + lines tdown; // Variables. // @@ -145,13 +143,37 @@ namespace build2 value& append (const variable&); - // Pre-parse. - // public: - vector lines; + virtual + ~scope () = default; + + protected: + scope (scope* p): parent (p) {} + scope (): parent (nullptr) {} // For the root (script) scope. + }; + + class group: public scope + { + public: + vector> scopes; + + public: + group (group& p): scope (&p) {} + + protected: + group (): scope (nullptr) {} // For the root (script) scope. + }; + + class test: public scope + { + public: + lines tests; + + public: + test (group& p): scope (&p) {} }; - class script: public scope + class script: public group { public: script (target& test_target, testscript& script_target); -- cgit v1.1