diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-15 13:09:39 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-15 13:09:46 -0700 |
commit | b6e33d0222cff567d49aa034900bb5c1db209886 (patch) | |
tree | bd2b218caec84ad88e0e74e5ab36cc6ab244b6d8 /tangle | |
parent | 1fd293c13e9e69df1ad65afe451821ef6ba6d941 (diff) | |
download | mu-b6e33d0222cff567d49aa034900bb5c1db209886.tar.gz |
3363 - bugfix in tangle
Diffstat (limited to 'tangle')
-rw-r--r-- | tangle/003tangle.cc | 2 | ||||
-rw-r--r-- | tangle/003tangle.test.cc | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/tangle/003tangle.cc b/tangle/003tangle.cc index 276cad67..c01cdb60 100644 --- a/tangle/003tangle.cc +++ b/tangle/003tangle.cc @@ -335,7 +335,7 @@ void emit_test(const string& name, list<Line>& lines, list<Line>& result) { bool is_input(const string& line) { if (line.empty()) return true; - return line != "===" && line.at(0) != '+' && line.at(0) != '-' && line.at(0) != '$' && line.at(0) != '?'; + return line != "===" && line.find_first_of("+-$?%") != 0; } Line input_lines(list<Line>& hunk) { diff --git a/tangle/003tangle.test.cc b/tangle/003tangle.test.cc index 45e1f110..4a28a622 100644 --- a/tangle/003tangle.test.cc +++ b/tangle/003tangle.test.cc @@ -232,6 +232,17 @@ void test_tangle_can_include_c_code_at_end_of_scenario() { CHECK(lines.empty()); } +void test_tangle_can_include_c_code_at_end_of_scenario_without_trace_expectations() { + istringstream in(":(scenario does_bar)\nabc def\n% int x = 1;"); + list<Line> lines; + tangle(in, lines); + CHECK_EQ(lines.front().contents, "void test_does_bar() {"); lines.pop_front(); + CHECK_EQ(lines.front().contents, " run(\"abc def\\n\");"); lines.pop_front(); + CHECK_EQ(lines.front().contents, " int x = 1;"); lines.pop_front(); + CHECK_EQ(lines.front().contents, "}"); lines.pop_front(); + CHECK(lines.empty()); +} + void test_tangle_supports_strings_in_scenarios() { istringstream in(":(scenario does_bar)\nabc \"def\"\n+layer1: pqr\n+layer2: \"xyz\""); list<Line> lines; |