Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rmtrail now handles single-line comments following trailing comma

  • Loading branch information...
commit 44a45d1f441ee8a6819f9e2521f6b6df4e02c376 1 parent 29576cf
@mikegerwitz authored
Showing with 11 additions and 3 deletions.
  1. +10 −2 test/test-rmtrail
  2. +1 −1  tools/rmtrail
View
12 test/test-rmtrail
@@ -27,7 +27,11 @@ TEST_DATA=$( echo '[a,b,]{a,b,}[
]{
a,
b,
- }' \
+ }
+ [c, // comment]
+ [d, //comment
+ ]
+ [e,// comment]' \
| $PATH_TOOLS/rmtrail
)
@@ -38,7 +42,11 @@ TEST_CMP='[a,b]{a,b}[
]{
a,
b
- }'
+ }
+ [c // comment]
+ [d //comment
+ ]
+ [e// comment]' \
# perform the assertion
if [ ! "$TEST_DATA" == "$TEST_CMP" ]; then
View
2  tools/rmtrail
@@ -41,7 +41,7 @@ cat - \
$ {
# pull from hold and perform replacement
g
- s/,\(\s*[]}]\)/\1/g
+ s/,\(\s*\(\/\/[^]}\n]\+\s*\)\?[]}]\)/\1/g
# print result
p
Please sign in to comment.
Something went wrong with that request. Please try again.