use opt instead of options; use bt instead of test_fragment

This commit is contained in:
Rasmus Jensen 2013-04-19 12:39:45 +02:00
parent 58bac2f623
commit 7f9c57358c
3 changed files with 8 additions and 7 deletions

View File

@ -176,6 +176,7 @@
opt.preserve_newlines = (options.preserve_newlines === undefined) ? true : options.preserve_newlines;
opt.break_chained_methods = (options.break_chained_methods === undefined) ? false : options.break_chained_methods;
opt.max_preserve_newlines = (options.max_preserve_newlines === undefined) ? 0 : parseInt(options.max_preserve_newlines, 10);
opt.space_in_paren = (options.space_in_paren === undefined) ? false : options.space_in_paren;
opt.jslint_happy = (options.jslint_happy === undefined) ? false : options.jslint_happy;
opt.keep_array_indentation = (options.keep_array_indentation === undefined) ? false : options.keep_array_indentation;
opt.space_before_conditional= (options.space_before_conditional === undefined) ? true : options.space_before_conditional;
@ -866,7 +867,7 @@
}
set_mode(MODE.Expression);
print_token();
if (options.space_in_paren) {
if (opt.space_in_paren) {
output_space_before_token = true;
}
return;
@ -923,7 +924,7 @@
}
}
print_token();
if (options.space_in_paren) {
if (opt.space_in_paren) {
output_space_before_token = true;
}
if (token_text === '[') {
@ -943,7 +944,7 @@
print_newline();
}
restore_mode();
if (options.space_in_paren) {
if (opt.space_in_paren) {
output_space_before_token = true;
}
print_token();

View File

@ -906,9 +906,9 @@ function run_beautifier_tests(test_obj, Urlencoded, js_beautify)
'a = 1;\n\n\n\n\n\n\n\nb = 2;');
// Test the option to have spaces within parens
test_fragment('if(p) foo(a,b)', 'if (p) foo(a, b)');
bt('if(p) foo(a,b)', 'if (p) foo(a, b)');
opts.space_in_paren = true
test_fragment('if(p) foo(a,b)', 'if ( p ) foo( a, b )');
bt('if(p) foo(a,b)', 'if ( p ) foo( a, b )');
opts.space_in_paren = false;
Urlencoded.run_tests(sanitytest);

View File

@ -841,9 +841,9 @@ class TestJSBeautifier(unittest.TestCase):
'a = 1;\n\n\n\n\n\n\n\nb = 2;');
# Test the option to have spaces within parens
test_fragment('if(p) foo(a,b)', 'if (p) foo(a, b)');
bt('if(p) foo(a,b)', 'if (p) foo(a, b)');
self.options.space_in_paren = True
test_fragment('if(p) foo(a,b)', 'if ( p ) foo( a, b )');
bt('if(p) foo(a,b)', 'if ( p ) foo( a, b )');
self.options.space_in_paren = False