about summary refs log tree commit diff stats
path: root/cpp/tangle
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/tangle')
-rw-r--r--cpp/tangle/030tangle.cc22
-rw-r--r--cpp/tangle/030tangle.test.cc37
2 files changed, 1 insertions, 58 deletions
diff --git a/cpp/tangle/030tangle.cc b/cpp/tangle/030tangle.cc
index ec34c944..2f81b23f 100644
--- a/cpp/tangle/030tangle.cc
+++ b/cpp/tangle/030tangle.cc
@@ -203,10 +203,7 @@ list<string>::iterator balancing_curly(list<string>::iterator orig) {
 void emit_test(const string& name, list<string>& lines, list<string>& result) {
   result.push_back("TEST("+name+")");
   while (any_non_input_line(lines)) {
-    if (!any_line_starts_with(lines, "=>"))
-      emit_session(lines, result);  // simpler version; no need to check result
-    else
-      emit_result_checking_session(lines, result);
+    result.push_back("  "+Toplevel+"(\""+input_lines(lines)+"\");");
     if (!lines.empty() && lines.front()[0] == '+')
       result.push_back("  CHECK_TRACE_CONTENTS(\""+expected_in_trace(lines)+"\");");
     while (!lines.empty() && lines.front()[0] == '-') {
@@ -233,23 +230,6 @@ void emit_test(const string& name, list<string>& lines, list<string>& result) {
   }
 }
 
-void emit_session(list<string>& lines, list<string>& result) {
-  result.push_back("  "+Toplevel+"(\""+input_lines(lines)+"\");");
-}
-
-void emit_result_checking_session(list<string>& lines, list<string>& result) {
-  result.push_back("{");
-  result.push_back("  ostringstream os;");
-  result.push_back("  TEMP(tmp, "+Toplevel+"(\""+input_lines(lines)+"\"));");
-  result.push_back("  os << tmp;");
-  if (!lines.empty() && starts_with(lines.front(), "=>")) {
-    size_t pos = lines.front().find("=>")+2;  // length of '=>'
-    result.push_back("  CHECK_EQ(os.str(), \""+trim(string(lines.front(), pos))+"\");");
-    lines.pop_front();
-  }
-  result.push_back("}");
-}
-
 bool is_input(const string& line) {
   return line != "===" && line[0] != '+' && line[0] != '-' && !starts_with(line, "=>");
 }
diff --git a/cpp/tangle/030tangle.test.cc b/cpp/tangle/030tangle.test.cc
index eb468894..950123f2 100644
--- a/cpp/tangle/030tangle.test.cc
+++ b/cpp/tangle/030tangle.test.cc
@@ -189,43 +189,6 @@ void test_tangle_can_check_for_absence_at_end_of_scenarios2() {
   CHECK(lines.empty());
 }
 
-void test_tangle_can_check_return_values_of_scenarios() {
-  istringstream in(":(scenario does_bar)\nabc def\n=> pqr");
-  list<string> lines;
-  tangle(in, lines);
-  CHECK_EQ(lines.front(), "TEST(does_bar)");  lines.pop_front();
-  CHECK_EQ(lines.front(), "{");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  ostringstream os;");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  TEMP(tmp, run(\"abc def\\n\"));");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  os << tmp;");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  CHECK_EQ(os.str(), \"pqr\");");  lines.pop_front();
-  CHECK_EQ(lines.front(), "}");  lines.pop_front();
-  CHECK_EQ(lines.front(), "}");  lines.pop_front();
-  CHECK(lines.empty());
-}
-
-void test_tangle_can_check_return_values_of_multiple_scenarios() {
-  istringstream in(":(scenario does_bar)\nabc\n=> pqr\n+layer1: pqr\ndef\n=> xyz\n");
-  list<string> lines;
-  tangle(in, lines);
-  CHECK_EQ(lines.front(), "TEST(does_bar)");  lines.pop_front();
-  CHECK_EQ(lines.front(), "{");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  ostringstream os;");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  TEMP(tmp, run(\"abc\\n\"));");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  os << tmp;");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  CHECK_EQ(os.str(), \"pqr\");");  lines.pop_front();
-  CHECK_EQ(lines.front(), "}");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  CHECK_TRACE_CONTENTS(\"layer1: pqr\");");  lines.pop_front();
-  CHECK_EQ(lines.front(), "{");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  ostringstream os;");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  TEMP(tmp, run(\"def\\n\"));");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  os << tmp;");  lines.pop_front();
-  CHECK_EQ(lines.front(), "  CHECK_EQ(os.str(), \"xyz\");");  lines.pop_front();
-  CHECK_EQ(lines.front(), "}");  lines.pop_front();
-  CHECK_EQ(lines.front(), "}");  lines.pop_front();
-  CHECK(lines.empty());
-}
-
 
 
 void test_trim() {