diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-21 11:25:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:34 +0200 |
commit | 096b10b96162eca90958af42e24520e2bc728494 (patch) | |
tree | 81162704a4273d4550c0d2b9f90646b73a8674fc /build2/test/script/script | |
parent | d7c4a08efd25ac11d5931a3bd2c50fbe717faa8b (diff) |
Add notion of testscript test and group scopes
Diffstat (limited to 'build2/test/script/script')
-rw-r--r-- | build2/test/script/script | 42 |
1 files changed, 32 insertions, 10 deletions
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<line>; + // 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<line> lines; + virtual + ~scope () = default; + + protected: + scope (scope* p): parent (p) {} + scope (): parent (nullptr) {} // For the root (script) scope. + }; + + class group: public scope + { + public: + vector<unique_ptr<scope>> 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); |