summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-07-20 15:09:43 +0200
committerBram Moolenaar <Bram@vim.org>2011-07-20 15:09:43 +0200
commit76f7fd3df3d9eac04928427568feb1fbc3fb889d (patch)
treeab83cb789aa33a3095d8a2c04a900ae83c04b2e3 /src
parentb560983d2f610f7098b6977b2e8fec0554a41ad1 (diff)
downloadvim-git-76f7fd3df3d9eac04928427568feb1fbc3fb889d.tar.gz
updated for version 7.3.256v7.3.256
Problem: Javascript indenting not sufficiently tested. Solution: Add more tests. (Luc Deschenaux) Mark the lines that are indented wrong.
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test3.in141
-rw-r--r--src/testdir/test3.ok114
-rw-r--r--src/version.c2
3 files changed, 256 insertions, 1 deletions
diff --git a/src/testdir/test3.in b/src/testdir/test3.in
index aea055fb3..55ca2a5a7 100644
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
@@ -1592,7 +1592,7 @@ NAMESPACEEND
STARTTEST
-:set cino=J1
+:set cino=j1,J1
/^JSSTART
=/^JSEND
ENDTEST
@@ -1613,6 +1613,145 @@ x: 4,
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||{}));
+}
+})(jQuery);
+JSEND
+
+STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/start of AUTO/,$wq! test.out
ENDTEST
diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok
index a47566931..396230744 100644
--- a/src/testdir/test3.ok
+++ b/src/testdir/test3.ok
@@ -1443,3 +1443,117 @@ var bar = {
}
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
+
diff --git a/src/version.c b/src/version.c
index 2f2307f1e..3783bbf0c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -710,6 +710,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 256,
+/**/
255,
/**/
254,