MCPcopy Create free account
hub / github.com/KDE/kdiff3 / removeComment

Method removeComment

src/autotests/commentparser.cpp:313–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311 }
312
313 void removeComment()
314 {
315 DefaultCommentParser test;
316 QString line=u8" qint32 i = 8 / 8 * 3;", correct=u8" qint32 i = 8 / 8 * 3;";
317
318 test.processLine(line);
319 test.removeComment(line);
320 QCOMPARE(line, correct);
321 QCOMPARE(line.length(), correct.length());
322
323 test = DefaultCommentParser();
324 correct = line = u8" //qint32 i = 8 / 8 * 3;";
325
326 test.processLine(line);
327 test.removeComment(line);
328 QCOMPARE(line, correct);
329
330 test = DefaultCommentParser();
331 correct = line = u8"// qint32 i = 8 / 8 * 3;";
332
333 test.processLine(line);
334 test.removeComment(line);
335 QCOMPARE(line, correct);
336 QCOMPARE(line.length(), correct.length());
337
338 test = DefaultCommentParser();
339 line = u8" qint32 i = 8 / 8 * 3;// comment";
340 correct = u8" qint32 i = 8 / 8 * 3; ";
341
342 test.processLine(line);
343 test.removeComment(line);
344 QCOMPARE(line, correct);
345 QCOMPARE(line.length(), correct.length());
346
347 test = DefaultCommentParser();
348 line = u8" qint32 i = 8 / 8 * 3;/* comment";
349 correct = u8" qint32 i = 8 / 8 * 3; ";
350
351 test.processLine(line);
352 test.removeComment(line);
353 QCOMPARE(line, correct);
354 QCOMPARE(line.length(), correct.length());
355
356 correct = line = u8" qint32 i = 8 / 8 * 3;/* mot a comment";
357 test.processLine(line);
358 test.removeComment(line);
359 QCOMPARE(line, correct);
360 QCOMPARE(line.length(), correct.length());
361
362 //end comment mid-line
363 line = u8"d */ why";
364 correct = u8" why";
365
366 test.processLine(line);
367 test.removeComment(line);
368 QCOMPARE(line, correct);
369 QCOMPARE(line.length(), correct.length());
370

Callers

nothing calls this directly

Calls 2

processLineMethod · 0.80

Tested by

no test coverage detected