diff options
-rw-r--r-- | cpp/tangle/030tangle.cc | 4 | ||||
-rw-r--r-- | cpp/tangle/030tangle.test.cc | 8 |
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; |