Skip to content

Commit afdf4d4

Browse files
committed
Remove the last "\n" from result
1 parent 446a46b commit afdf4d4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

PHPCtags.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ private function render($structs, $options)
281281
$str .= "\n";
282282
}
283283

284+
// remove the last line ending
285+
$str = trim($str);
286+
284287
// sort the result as instructed
285288
if (isset($options['sort']) && ($options['sort'] == 'yes' || $options['sort'] == 'foldcase')) {
286289
$str = self::stringSortByLine($str, $options['sort'] == 'foldcase');

tests/PHPCtagsTestCase.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public function getExpectResult()
7575
$testcase_expect .= $line;
7676
}
7777

78+
// remove the last line ending
79+
$testcase_expect = trim($testcase_expect);
80+
7881
return $testcase_expect;
7982

8083
}

0 commit comments

Comments
 (0)