diff src/testdir/test_goto.vim @ 17172:6990c1160ea5 v8.1.1585

patch 8.1.1585: :let-heredoc does not trim enough commit https://github.com/vim/vim/commit/e7eb92708ec2092a2fc11e78703b5dcf83844412 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 24 00:58:07 2019 +0200 patch 8.1.1585: :let-heredoc does not trim enough Problem: :let-heredoc does not trim enough. Solution: Trim indent from the contents based on the indent of the first line. Use let-heredoc in more tests.
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 Jun 2019 01:00:05 +0200
parents 9c90cf08cfa8
children a4bd28e2cf1d
line wrap: on
line diff
--- a/src/testdir/test_goto.vim
+++ b/src/testdir/test_goto.vim
@@ -16,12 +16,12 @@ endfunc
 
 func Test_gD()
   let lines =<< trim [CODE]
-  int x;
-
-  int func(void)
-  {
-    return x;
-  }
+    int x;
+  
+    int func(void)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gD', lines, 1, 5)
@@ -29,12 +29,12 @@ endfunc
 
 func Test_gD_too()
   let lines =<< trim [CODE]
-  Filename x;
-
-  int Filename
-  int func() {
     Filename x;
-    return x;
+  
+    int Filename
+    int func() {
+      Filename x;
+      return x;
   [CODE]
 
   call XTest_goto_decl('gD', lines, 1, 10)
@@ -42,13 +42,13 @@ endfunc
 
 func Test_gD_comment()
   let lines =<< trim [CODE]
-  /* int x; */
-  int x;
-
-  int func(void)
-  {
-    return x;
-  }
+    /* int x; */
+    int x;
+  
+    int func(void)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gD', lines, 2, 5)
@@ -56,13 +56,13 @@ endfunc
 
 func Test_gD_inline_comment()
   let lines =<< trim [CODE]
-  int y /* , x */;
-  int x;
-
-  int func(void)
-  {
-    return x;
-  }
+    int y /* , x */;
+    int x;
+  
+    int func(void)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gD', lines, 2, 5)
@@ -70,13 +70,13 @@ endfunc
 
 func Test_gD_string()
   let lines =<< trim [CODE]
-  char *s[] = "x";
-  int x = 1;
-
-  int func(void)
-  {
-    return x;
-  }
+    char *s[] = "x";
+    int x = 1;
+  
+    int func(void)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gD', lines, 2, 5)
@@ -84,12 +84,12 @@ endfunc
 
 func Test_gD_string_same_line()
   let lines =<< trim [CODE]
-  char *s[] = "x", int x = 1;
-
-  int func(void)
-  {
-    return x;
-  }
+    char *s[] = "x", int x = 1;
+  
+    int func(void)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gD', lines, 1, 22)
@@ -97,13 +97,13 @@ endfunc
 
 func Test_gD_char()
   let lines =<< trim [CODE]
-  char c = 'x';
-  int x = 1;
-
-  int func(void)
-  {
-    return x;
-  }
+    char c = 'x';
+    int x = 1;
+  
+    int func(void)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gD', lines, 2, 5)
@@ -111,12 +111,12 @@ endfunc
 
 func Test_gd()
   let lines =<< trim [CODE]
-  int x;
-
-  int func(int x)
-  {
-    return x;
-  }
+    int x;
+  
+    int func(int x)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 3, 14)
@@ -124,15 +124,15 @@ endfunc
 
 func Test_gd_not_local()
   let lines =<< trim [CODE]
-  int func1(void)
-  {
-    return x;
-  }
-
-  int func2(int x)
-  {
-    return x;
-  }
+    int func1(void)
+    {
+      return x;
+    }
+  
+    int func2(int x)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 3, 10)
@@ -140,11 +140,11 @@ endfunc
 
 func Test_gd_kr_style()
   let lines =<< trim [CODE]
-  int func(x)
-    int x;
-  {
-    return x;
-  }
+    int func(x)
+      int x;
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 2, 7)
@@ -152,15 +152,15 @@ endfunc
 
 func Test_gd_missing_braces()
   let lines =<< trim [CODE]
-  def func1(a)
-    a + 1
-  end
-
-  a = 1
-
-  def func2()
-    return a
-  end
+    def func1(a)
+      a + 1
+    end
+  
+    a = 1
+  
+    def func2()
+      return a
+    end
   [CODE]
 
   call XTest_goto_decl('gd', lines, 1, 11)
@@ -168,12 +168,12 @@ endfunc
 
 func Test_gd_comment()
   let lines =<< trim [CODE]
-  int func(void)
-  {
-    /* int x; */
-    int x;
-    return x;
-  }
+    int func(void)
+    {
+      /* int x; */
+      int x;
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 4, 7)
@@ -181,12 +181,12 @@ endfunc
 
 func Test_gd_comment_in_string()
   let lines =<< trim [CODE]
-  int func(void)
-  {
-    char *s ="//"; int x;
-    int x;
-    return x;
-  }
+    int func(void)
+    {
+      char *s ="//"; int x;
+      int x;
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 3, 22)
@@ -195,12 +195,12 @@ endfunc
 func Test_gd_string_in_comment()
   set comments=
   let lines =<< trim [CODE]
-  int func(void)
-  {
-    /* " */ int x;
-    int x;
-    return x;
-  }
+    int func(void)
+    {
+      /* " */ int x;
+      int x;
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 3, 15)
@@ -209,10 +209,10 @@ endfunc
 
 func Test_gd_inline_comment()
   let lines =<< trim [CODE]
-  int func(/* x is an int */ int x)
-  {
-    return x;
-  }
+    int func(/* x is an int */ int x)
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 1, 32)
@@ -220,10 +220,10 @@ endfunc
 
 func Test_gd_inline_comment_only()
   let lines =<< trim [CODE]
-  int func(void) /* one lonely x */
-  {
-    return x;
-  }
+    int func(void) /* one lonely x */
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 3, 10)
@@ -231,16 +231,16 @@ endfunc
 
 func Test_gd_inline_comment_body()
   let lines =<< trim [CODE]
-  int func(void)
-  {
-    int y /* , x */;
-
-    for (/* int x = 0 */; y < 2; y++);
-
-    int x = 0;
-
-    return x;
-  }
+    int func(void)
+    {
+      int y /* , x */;
+  
+      for (/* int x = 0 */; y < 2; y++);
+  
+      int x = 0;
+  
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 7, 7)
@@ -248,10 +248,10 @@ endfunc
 
 func Test_gd_trailing_multiline_comment()
   let lines =<< trim [CODE]
-  int func(int x) /* x is an int */
-  {
-    return x;
-  }
+    int func(int x) /* x is an int */
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 1, 14)
@@ -259,10 +259,10 @@ endfunc
 
 func Test_gd_trailing_comment()
   let lines =<< trim [CODE]
-  int func(int x) // x is an int
-  {
-    return x;
-  }
+    int func(int x) // x is an int
+    {
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 1, 14)
@@ -270,25 +270,25 @@ endfunc
 
 func Test_gd_string()
   let lines =<< trim [CODE]
-  int func(void)
-  {
-    char *s = "x";
-    int x = 1;
-
-    return x;
-  }
+    int func(void)
+    {
+      char *s = "x";
+      int x = 1;
+  
+      return x;
+    }
   [CODE]
   call XTest_goto_decl('gd', lines, 4, 7)
 endfunc
 
 func Test_gd_string_only()
   let lines =<< trim [CODE]
-  int func(void)
-  {
-    char *s = "x";
-
-    return x;
-  }
+    int func(void)
+    {
+      char *s = "x";
+  
+      return x;
+    }
   [CODE]
 
   call XTest_goto_decl('gd', lines, 5, 10)
@@ -311,21 +311,21 @@ endfunc
 func Test_gd_local_block()
   let lines =<< trim [CODE]
     int main()
-  {
-    char *a = "NOT NULL";
-    if(a)
     {
-      char *b = a;
-      printf("%s\n", b);
+      char *a = "NOT NULL";
+      if(a)
+      {
+        char *b = a;
+        printf("%s\n", b);
+      }
+      else
+      {
+        char *b = "NULL";
+        return b;
+      }
+  
+      return 0;
     }
-    else
-    {
-      char *b = "NULL";
-      return b;
-    }
-
-    return 0;
-  }
   [CODE]
 
   call XTest_goto_decl('1gd', lines, 11, 11)