From 0cc4f18dd56e2e6a80809d48ef1d1e0fb302029e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 29 Apr 2015 17:07:40 -0700 Subject: 1222 --- cpp/052scenario_trace.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'cpp/052scenario_trace.cc') diff --git a/cpp/052scenario_trace.cc b/cpp/052scenario_trace.cc index 4436ee3f..cf782835 100644 --- a/cpp/052scenario_trace.cc +++ b/cpp/052scenario_trace.cc @@ -1,5 +1,23 @@ -//: Support a scenario [ ... ] form at the top level so we can start creating -//: scenarios in mu just like we do in C++. +//: Support a trace block inside scenario blocks. +//: Allows two kinds of assertions: +//: trace must contain [ ... ] +//: trace must not contain [ ... ] + +:(scenarios "parse_scenario") +:(scenario scenario_trace_block) +scenario foo [ + trace should contain [ + bar: baz + bar: floo + ] + trace should not contain [ + bar: abc + ] + +] ++scenario: +bar: baz ++scenario: +bar: floo ++scenario: -bar: abc :(before "End scenario Fields") vector > trace_checks; @@ -43,7 +61,7 @@ void handle_scenario_trace_directive(istream& in, scenario& out) { } string message = slurp_rest(tmp); out.trace_checks.push_back(pair(label, message)); - trace("scenario") << "trace: " << label << ": " << message << '\n'; + trace("scenario") << '+' << label << ": " << message << '\n'; } skip_whitespace(in); assert(in.get() == ']'); @@ -70,7 +88,7 @@ void handle_scenario_trace_negative_directive(istream& in, scenario& out) { } string message = slurp_rest(tmp); out.trace_negative_checks.push_back(pair(label, message)); - trace("scenario") << "trace: " << label << ": " << message << '\n'; + trace("scenario") << '-' << label << ": " << message << '\n'; } skip_whitespace(in); assert(in.get() == ']'); -- cgit 1.4.1-2-gfad0