Permalink
Browse files

Add : as valid string separator. Fixes #46

  • Loading branch information...
1 parent 3594c4d commit a0c609828a3bb46ebc1ea50af84b326f63be38ed @ccampbell committed May 10, 2012
Showing with 49 additions and 1 deletion.
  1. +1 −1 js/language/generic.js
  2. +48 −0 tests/language/javascript-test.js
@@ -19,7 +19,7 @@ Rainbow.extend([
}
}
},
- 'pattern': /(\(|\s|\[|\=)(('|")([^\\\1]|\\.)*?(\3))/gm
+ 'pattern': /(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm
},
{
'name': 'comment',
@@ -115,4 +115,52 @@ RainbowTester.run(
'};'
);
+RainbowTester.run(
+ 'JSON 1',
+
+ '{\n' +
+ ' "generated_in": "0.0423",\n' +
+ ' "stat": "fail"\n' +
+ ' "err": {\n' +
+ ' "code": "1",\n' +
+ ' "expl": "The user id or name was either not valid or not provided.",\n' +
+ ' "msg": "User not found"\n' +
+ ' }\n' +
+ '}',
+
+ '{\n' +
+ ' <span class="string">"generated_in"</span>: <span class="string">"0.0423"</span>,\n' +
+ ' <span class="string">"stat"</span>: <span class="string">"fail"</span>\n' +
+ ' <span class="string">"err"</span>: {\n' +
+ ' <span class="string">"code"</span>: <span class="string">"1"</span>,\n' +
+ ' <span class="string">"expl"</span>: <span class="string">"The user id or name was either not valid or not provided."</span>,\n' +
+ ' <span class="string">"msg"</span>: <span class="string">"User not found"</span>\n' +
+ ' }\n' +
+ '}'
+);
+
+RainbowTester.run(
+ 'JSON 2',
+
+ '{\n' +
+ ' "generated_in":"0.0423",\n' +
+ ' "stat":"fail"\n' +
+ ' "err":{\n' +
+ ' "code":"1",\n' +
+ ' "expl":"The user id or name was either not valid or not provided.",\n' +
+ ' "msg":"User not found"\n' +
+ ' }\n' +
+ '}',
+
+ '{\n' +
+ ' <span class="string">"generated_in"</span>:<span class="string">"0.0423"</span>,\n' +
+ ' <span class="string">"stat"</span>:<span class="string">"fail"</span>\n' +
+ ' <span class="string">"err"</span>:{\n' +
+ ' <span class="string">"code"</span>:<span class="string">"1"</span>,\n' +
+ ' <span class="string">"expl"</span>:<span class="string">"The user id or name was either not valid or not provided."</span>,\n' +
+ ' <span class="string">"msg"</span>:<span class="string">"User not found"</span>\n' +
+ ' }\n' +
+ '}'
+);
+
RainbowTester.endTest('javascript');

0 comments on commit a0c6098

Please sign in to comment.