about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-22 10:00:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-22 10:00:33 -0700
commit0a3bc57c4f060363c98721955f4f77dcf92444f9 (patch)
tree145b1d6a9f183c82bd5bed5bc850e24e959cfd8d /cpp
parenta6a8cfdde7c83b29a2ed76e887887355119ec1a1 (diff)
downloadmu-0a3bc57c4f060363c98721955f4f77dcf92444f9.tar.gz
1121
Diffstat (limited to 'cpp')
-rw-r--r--cpp/tangle/030tangle.cc4
-rw-r--r--cpp/tangle/030tangle.test.cc8
2 files changed, 12 insertions, 0 deletions
diff --git a/cpp/tangle/030tangle.cc b/cpp/tangle/030tangle.cc
index 7f3f23c5..a7769129 100644
--- a/cpp/tangle/030tangle.cc
+++ b/cpp/tangle/030tangle.cc
@@ -95,6 +95,10 @@ void process_next_hunk(istream& in, const string& directive, const string& filen
       in.seekg(old);
       break;
     }
+    if (starts_with(curr_line, "//:")) {
+      ++line_number;
+      continue;
+    }
     Line curr;
     curr.line_number = line_number;
     curr.filename = filename;
diff --git a/cpp/tangle/030tangle.test.cc b/cpp/tangle/030tangle.test.cc
index f0abd030..8203b8a6 100644
--- a/cpp/tangle/030tangle.test.cc
+++ b/cpp/tangle/030tangle.test.cc
@@ -69,6 +69,14 @@ void test_tangle_with_tanglecomments_and_directive() {
   CHECK_TRACE_DOESNT_CONTAIN("tangle", "//: 1");
 }
 
+void test_tangle_with_tanglecomments_inside_directive() {
+  istringstream in("a\n//: 1\nb\nc\n:(before b)\n//: abc\nd\n:(code)\ne\n");
+  list<Line> dummy;
+  tangle(in, dummy);
+  CHECK_TRACE_CONTENTS("tangle", "a#line 7d#line 3bc#line 9e");
+  CHECK_TRACE_DOESNT_CONTAIN("tangle", "//: 1");
+}
+
 void test_tangle2() {
   istringstream in("a\nb\nc\n:(after b)\nd\n");
   list<Line> dummy;