0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.3.256

Problem:    Javascript indenting not sufficiently tested.
Solution:   Add more tests. (Luc Deschenaux)  Mark the lines that are indented
            wrong.
This commit is contained in:
Bram Moolenaar
2011-07-20 15:09:43 +02:00
parent b560983d2f
commit 76f7fd3df3
3 changed files with 256 additions and 1 deletions

View File

@@ -1592,7 +1592,7 @@ NAMESPACEEND
namespace111111111 namespace111111111
{ {
111111111111111111; 111111111111111111;
} }
NAMESPACEEND NAMESPACEEND
@@ -1612,6 +1612,145 @@ x: 4,
a : 2, a : 2,
b: "123abc", b: "123abc",
x: 4, x: 4,
"y": 5
}
}
JSEND
STARTTEST
:set cino=j1,J1
/^JSSTART
=/^JSEND
ENDTEST
JSSTART
var foo = [
1, // indent 8 more
2,
3
]; // indent 8 less
JSEND
STARTTEST
:set cino=j1,J1
/^JSSTART
=/^JSEND
ENDTEST
JSSTART
function bar() {
var foo = [
1,
2,
3
]; // indent 16 less
}
JSEND
STARTTEST
:set cino=j1,J1
/^JSSTART
=/^JSEND
ENDTEST
JSSTART
(function($){
var class_name='myclass';
function private_method() {
}
var public_method={
method: function(options,args){
private_method();
}
}
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2, // indent 8 more
foobar: [ // indent 8 more
1, // indent 8 more
2, // indent 16 more
3 // indent 16 more
],
callback: function(){ // indent 8 more
return true; // indent 8 more
} // indent 8 more
}, options||{}));
}
$.fn[class_name]=function() {
var _arguments=arguments;
return this.each(function(){
var options=$(this).data(class_name+'_public');
if (!options) {
init.apply(this,_arguments);
} else {
var method=public_method[_arguments[0]];
if (typeof(method)!='function') {
console.log(class_name+' has no method "'+_arguments[0]+'"');
return false;
}
_arguments[0]=options;
method.apply(this,_arguments);
}
});
}
})(jQuery);
JSEND
STARTTEST
:set cino=j1,J1
/^JSSTART
=/^JSEND
ENDTEST
JSSTART
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2,
foobar: [
1, // indent 8 more
2, // indent 8 more
3 // indent 8 more
],
callback: function(){
return true;
}
}, options||{}));
}
JSEND
STARTTEST
:set cino=j1,J1
/^JSSTART
=/^JSEND
ENDTEST
JSSTART
(function($){
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2, // indent 8 more
foobar: [ // indent 8 more
1, // indent 8 more
2, // indent 16 more
3 // indent 16 more
],
callback: function(){ // indent 8 more
return true; // indent 8 more
} // indent 8 more
}, options||{})); }, options||{}));
} }
})(jQuery); })(jQuery);

View File

@@ -1443,3 +1443,117 @@ var bar = {
} }
JSEND JSEND
JSSTART
var foo = [
1, // indent 8 more
2,
3
]; // indent 8 less
JSEND
JSSTART
function bar() {
var foo = [
1,
2,
3
]; // indent 16 less
}
JSEND
JSSTART
(function($){
var class_name='myclass';
function private_method() {
}
var public_method={
method: function(options,args){
private_method();
}
}
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2, // indent 8 more
foobar: [ // indent 8 more
1, // indent 8 more
2, // indent 16 more
3 // indent 16 more
],
callback: function(){ // indent 8 more
return true; // indent 8 more
} // indent 8 more
}, options||{}));
}
$.fn[class_name]=function() {
var _arguments=arguments;
return this.each(function(){
var options=$(this).data(class_name+'_public');
if (!options) {
init.apply(this,_arguments);
} else {
var method=public_method[_arguments[0]];
if (typeof(method)!='function') {
console.log(class_name+' has no method "'+_arguments[0]+'"');
return false;
}
_arguments[0]=options;
method.apply(this,_arguments);
}
});
}
})(jQuery);
JSEND
JSSTART
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2,
foobar: [
1, // indent 8 more
2, // indent 8 more
3 // indent 8 more
],
callback: function(){
return true;
}
}, options||{}));
}
JSEND
JSSTART
(function($){
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2, // indent 8 more
foobar: [ // indent 8 more
1, // indent 8 more
2, // indent 16 more
3 // indent 16 more
],
callback: function(){ // indent 8 more
return true; // indent 8 more
} // indent 8 more
}, options||{}));
}
})(jQuery);
JSEND

View File

@@ -709,6 +709,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
256,
/**/ /**/
255, 255,
/**/ /**/