mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-27 14:40:23 +00:00
Tests for spaces inside square bracket support
Introduced but not tested as part of #235. Closes #126.
This commit is contained in:
parent
a1fa05c4b0
commit
82e18999a1
@ -916,6 +916,12 @@ function run_beautifier_tests(test_obj, Urlencoded, js_beautify)
|
||||
bt('((e/((a+(b)*c)-d))^2)*5;', '((e / ((a + (b) * c) - d)) ^ 2) * 5;');
|
||||
bt('function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
|
||||
'function f(a, b) {\n if (a) b()\n}\nfunction g(a, b) {\n if (!a) b()\n}');
|
||||
bt('a=[];',
|
||||
'a = [];');
|
||||
bt('a=[b,c,d];',
|
||||
'a = [b, c, d];');
|
||||
bt('a= f[b];',
|
||||
'a = f[b];');
|
||||
opts.space_in_paren = true
|
||||
bt('if(p) foo(a,b)', 'if ( p ) foo( a, b )');
|
||||
bt('try{while(true){willThrow()}}catch(result)switch(result){case 1:++result }',
|
||||
@ -923,6 +929,12 @@ function run_beautifier_tests(test_obj, Urlencoded, js_beautify)
|
||||
bt('((e/((a+(b)*c)-d))^2)*5;', '( ( e / ( ( a + ( b ) * c ) - d ) ) ^ 2 ) * 5;');
|
||||
bt('function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
|
||||
'function f( a, b ) {\n if ( a ) b( )\n}\nfunction g( a, b ) {\n if ( !a ) b( )\n}');
|
||||
bt('a=[ ];',
|
||||
'a = [ ];');
|
||||
bt('a=[b,c,d];',
|
||||
'a = [ b, c, d ];');
|
||||
bt('a= f[b];',
|
||||
'a = f[ b ];');
|
||||
opts.space_in_paren = false;
|
||||
|
||||
// Test that e4x literals passed through when e4x-option is enabled
|
||||
|
@ -851,6 +851,12 @@ class TestJSBeautifier(unittest.TestCase):
|
||||
bt('((e/((a+(b)*c)-d))^2)*5;', '((e / ((a + (b) * c) - d)) ^ 2) * 5;');
|
||||
bt('function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
|
||||
'function f(a, b) {\n if (a) b()\n}\nfunction g(a, b) {\n if (!a) b()\n}');
|
||||
bt('a=[];',
|
||||
'a = [];');
|
||||
bt('a=[b,c,d];',
|
||||
'a = [b, c, d];');
|
||||
bt('a= f[b];',
|
||||
'a = f[b];');
|
||||
self.options.space_in_paren = True
|
||||
bt('if(p) foo(a,b)', 'if ( p ) foo( a, b )');
|
||||
bt('try{while(true){willThrow()}}catch(result)switch(result){case 1:++result }',
|
||||
@ -858,6 +864,12 @@ class TestJSBeautifier(unittest.TestCase):
|
||||
bt('((e/((a+(b)*c)-d))^2)*5;', '( ( e / ( ( a + ( b ) * c ) - d ) ) ^ 2 ) * 5;');
|
||||
bt('function f(a,b) {if(a) b()}function g(a,b) {if(!a) b()}',
|
||||
'function f( a, b ) {\n if ( a ) b( )\n}\nfunction g( a, b ) {\n if ( !a ) b( )\n}');
|
||||
bt('a=[ ];',
|
||||
'a = [ ];');
|
||||
bt('a=[b,c,d];',
|
||||
'a = [ b, c, d ];');
|
||||
bt('a= f[b];',
|
||||
'a = f[ b ];');
|
||||
self.options.space_in_paren = False
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user