diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-28 10:10:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:36 +0200 |
commit | cd40097447ff2400cb420ec973c16dadd26e6cda (patch) | |
tree | bcd1c902d487e7a60ffffd5b02b7c608829fbc57 /unit-tests/test/script/parser/driver.cxx | |
parent | e61874e76052d3600d6f10807248f92935f3dd61 (diff) |
Implement description support in testscript
Diffstat (limited to 'unit-tests/test/script/parser/driver.cxx')
-rw-r--r-- | unit-tests/test/script/parser/driver.cxx | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/unit-tests/test/script/parser/driver.cxx b/unit-tests/test/script/parser/driver.cxx index aad94f9..18fcdce 100644 --- a/unit-tests/test/script/parser/driver.cxx +++ b/unit-tests/test/script/parser/driver.cxx @@ -35,12 +35,47 @@ namespace build2 virtual void enter (scope& s, const location&) override { + if (s.desc) + { + const auto& d (*s.desc); + + if (!d.id.empty ()) + cout << ind_ << ": id:" << d.id << endl; + + if (!d.summary.empty ()) + cout << ind_ << ": sm:" << d.summary << endl; + + if (!d.details.empty ()) + { + if (!d.id.empty () || !d.summary.empty ()) + cout << ind_ << ":" << endl; // Blank. + + const auto& s (d.details); + for (size_t b (0), e (0), n; e != string::npos; b = e + 1) + { + e = s.find ('\n', b); + n = ((e != string::npos ? e : s.size ()) - b); + + cout << ind_ << ':'; + if (n != 0) + { + cout << ' '; + cout.write (s.c_str () + b, static_cast<streamsize> (n)); + } + cout << endl; + } + } + } + if (scope_) { + cout << ind_ << "{"; + if (id_ && !s.id_path.empty ()) // Skip empty root scope id. - cout << ind_ << ": " << s.id_path.string () << endl; + cout << " # " << s.id_path.string (); + + cout << endl; - cout << ind_ << "{" << endl; ind_ += " "; } } |