]> granicus.if.org Git - vim/commitdiff
patch 8.1.1285: test17 is old style v8.1.1285
authorBram Moolenaar <Bram@vim.org>
Mon, 6 May 2019 20:00:00 +0000 (22:00 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 6 May 2019 20:00:00 +0000 (22:00 +0200)
Problem:    Test17 is old style.
Solution:   Turn into new style test. (Yegappan Lakshmanan, closes #4347)

src/Makefile
src/testdir/Make_all.mak
src/testdir/Make_vms.mms
src/testdir/test17.in [deleted file]
src/testdir/test17.ok [deleted file]
src/testdir/test17a.in [deleted file]
src/testdir/test_checkpath.vim [new file with mode: 0644]
src/testdir/test_gf.vim
src/version.c

index 65e79814492dc056fe83ceb963262c40d76475d0..10ba8755b7f43f556f708986b3abdf525a7d9215 100644 (file)
@@ -2175,7 +2175,7 @@ test_libvterm:
 # These do not depend on the executable, compile it when needed.
 test1 \
        test_eval \
-       test3 test17 \
+       test3 \
        test29 test30 test37 test39 \
        test42 test44 test48 test49 \
        test52 test59 \
index 25c8feec7296b368666472deda03613588621ce2..2bda7427682cd7cb1203020140f11c2aa91dc853 100644 (file)
@@ -44,7 +44,6 @@ SCRIPTS_MORE2 = \
 
 # Tests that run on most systems, but not on VMS
 SCRIPTS_MORE4 = \
-       test17.out \
        test30.out \
        test59.out \
        test72.out \
@@ -82,6 +81,7 @@ NEW_TESTS = \
        test_channel \
        test_charsearch \
        test_charsearch_utf8 \
+       test_checkpath \
        test_cindent \
        test_clientserver \
        test_close_count \
@@ -302,6 +302,7 @@ NEW_TESTS_RES = \
        test_changelist.res \
        test_channel.res \
        test_charsearch.res \
+       test_checkpath.res \
        test_cindent.res \
        test_clientserver.res \
        test_close_count.res \
index 8a92b4af288852b42f8e49c3b51eeba2435157a5..d72b9dac42492fe36dce6ee83a59f56fa0e3c1c4 100644 (file)
@@ -83,7 +83,6 @@ SCRIPT = test1.out test3.out \
        test_eval.out
 
 # Known problems:
-# test17: ?
 #
 # test30: bug, most probably - a problem around mac format
 #
@@ -102,7 +101,7 @@ GUI_OPTION = -g
 .ENDIF
 
 .IFDEF WANT_UNIX
-SCRIPT_UNIX = test10.out test17.out test27.out test49.out
+SCRIPT_UNIX = test10.out test27.out test49.out
 .ENDIF
 
 .IFDEF WANT_WIN
diff --git a/src/testdir/test17.in b/src/testdir/test17.in
deleted file mode 100644 (file)
index 59b57c2..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-Tests for:
-- "gf" on ${VAR},
-- ":checkpath!" with various 'include' settings.
-
-STARTTEST
-:so small.vim
-:if has("ebcdic")
-: set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,}
-:else
-: set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,}
-:endif
-:"
-:if has("unix")
-:let $CDIR = "."
-/CDIR
-:else
-:if has("amiga")
-:let $TDIR = "/testdir"
-:else
-:let $TDIR = "."
-:endif
-/TDIR
-:endif
-:" Dummy writing for making that sure gf doesn't fail even if the current
-:" file is modified. It can be occurred when executing the following command
-:" directly on Windows without fixing the 'fileformat':
-:"  > nmake -f Make_dos.mak test17.out
-:w! test.out
-gf
-:set ff=unix
-:w! test.out
-:brewind
-ENDTEST
-
-       ${CDIR}/test17a.in
-       $TDIR/test17a.in
-
-STARTTEST
-:" check for 'include' without \zs or \ze
-:lang C
-:call delete("./Xbase.a")
-:call delete("Xdir1", "rf")
-:!mkdir Xdir1
-:!mkdir "Xdir1/dir2"
-:e! Xdir1/dir2/foo.a
-i#include   "bar.a"\e:
-:w
-:e Xdir1/dir2/bar.a
-i#include      "baz.a"\e:
-:w
-:e Xdir1/dir2/baz.a
-i#include            "foo.a"\e:
-:w
-:e Xbase.a
-:set path=Xdir1/dir2
-i#include    <foo.a>\e:
-:w
-:redir! >>test.out
-:checkpath!
-:redir END
-:brewind
-ENDTEST
-
-STARTTEST
-:" check for 'include' with \zs and \ze
-:call delete("./Xbase.b")
-:call delete("Xdir1", "rf")
-:!mkdir Xdir1
-:!mkdir "Xdir1/dir2"
-:let &include='^\s*%inc\s*/\zs[^/]\+\ze'
-:function! DotsToSlashes()
-:  return substitute(v:fname, '\.', '/', 'g') . '.b'
-:endfunction
-:let &includeexpr='DotsToSlashes()'
-:e! Xdir1/dir2/foo.b
-i%inc   /bar/\e:
-:w
-:e Xdir1/dir2/bar.b
-i%inc      /baz/\e:
-:w
-:e Xdir1/dir2/baz.b
-i%inc            /foo/\e:
-:w
-:e Xbase.b
-:set path=Xdir1/dir2
-i%inc    /foo/\e:
-:w
-:redir! >>test.out
-:checkpath!
-:redir END
-:brewind
-ENDTEST
-
-STARTTEST
-:" check for 'include' with \zs and no \ze
-:call delete("./Xbase.c")
-:call delete("Xdir1", "rf")
-:!mkdir Xdir1
-:!mkdir "Xdir1/dir2"
-:let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze'
-:function! StripNewlineChar()
-:  if v:fname =~ '\n$'
-:    return v:fname[:-2]
-:  endif
-:  return v:fname
-:endfunction
-:let &includeexpr='StripNewlineChar()'
-:e! Xdir1/dir2/foo.c
-i%inc   bar.c\e:
-:w
-:e Xdir1/dir2/bar.c
-i%inc      baz.c\e:
-:w
-:e Xdir1/dir2/baz.c
-i%inc            foo.c\e:
-:w
-:e Xdir1/dir2/FALSE.c
-i%inc            foo.c\e:
-:w
-:e Xbase.c
-:set path=Xdir1/dir2
-i%inc    FALSE.c foo.c\e:
-:w
-:redir! >>test.out
-:checkpath!
-:redir END
-:brewind
-:" change "\" to "/" for Windows and fix 'fileformat'
-:e test.out
-:%s#\\#/#g
-:set ff&
-:w
-:q
-ENDTEST
-
diff --git a/src/testdir/test17.ok b/src/testdir/test17.ok
deleted file mode 100644 (file)
index b2a66d5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-This file is just to test "gf" in test 17.
-The contents is not important.
-Just testing!
-
-
---- Included files in path ---
-Xdir1/dir2/foo.a
-Xdir1/dir2/foo.a -->
-  Xdir1/dir2/bar.a
-  Xdir1/dir2/bar.a -->
-    Xdir1/dir2/baz.a
-    Xdir1/dir2/baz.a -->
-      "foo.a"  (Already listed)
-
-
---- Included files in path ---
-Xdir1/dir2/foo.b
-Xdir1/dir2/foo.b -->
-  Xdir1/dir2/bar.b
-  Xdir1/dir2/bar.b -->
-    Xdir1/dir2/baz.b
-    Xdir1/dir2/baz.b -->
-      foo  (Already listed)
-
-
---- Included files in path ---
-Xdir1/dir2/foo.c
-Xdir1/dir2/foo.c -->
-  Xdir1/dir2/bar.c
-  Xdir1/dir2/bar.c -->
-    Xdir1/dir2/baz.c
-    Xdir1/dir2/baz.c -->
-      foo.c  (Already listed)
diff --git a/src/testdir/test17a.in b/src/testdir/test17a.in
deleted file mode 100644 (file)
index 7e89364..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-This file is just to test "gf" in test 17.
-The contents is not important.
-Just testing!
diff --git a/src/testdir/test_checkpath.vim b/src/testdir/test_checkpath.vim
new file mode 100644 (file)
index 0000000..eff30cf
--- /dev/null
@@ -0,0 +1,104 @@
+" Tests for the :checkpath command
+
+" Test for 'include' without \zs or \ze
+func Test_checkpath1()
+  call mkdir("Xdir1/dir2", "p")
+  call writefile(['#include    "bar.a"'], 'Xdir1/dir2/foo.a')
+  call writefile(['#include    "baz.a"'], 'Xdir1/dir2/bar.a')
+  call writefile(['#include    "foo.a"'], 'Xdir1/dir2/baz.a')
+  call writefile(['#include    <foo.a>'], 'Xbase.a')
+
+  edit Xbase.a
+  set path=Xdir1/dir2
+  let res = split(execute("checkpath!"), "\n")
+  call assert_equal([
+             \ '--- Included files in path ---',
+             \ 'Xdir1/dir2/foo.a',
+             \ 'Xdir1/dir2/foo.a -->',
+             \ '  Xdir1/dir2/bar.a',
+             \ '  Xdir1/dir2/bar.a -->',
+             \ '    Xdir1/dir2/baz.a',
+             \ '    Xdir1/dir2/baz.a -->',
+             \ '      "foo.a"  (Already listed)'], res)
+
+  enew
+  call delete("./Xbase.a")
+  call delete("Xdir1", "rf")
+  set path&
+endfunc
+
+func DotsToSlashes()
+  return substitute(v:fname, '\.', '/', 'g') . '.b'
+endfunc
+
+" Test for 'include' with \zs and \ze
+func Test_checkpath2()
+  call mkdir("Xdir1/dir2", "p")
+  call writefile(['%inc    /bar/'], 'Xdir1/dir2/foo.b')
+  call writefile(['%inc    /baz/'], 'Xdir1/dir2/bar.b')
+  call writefile(['%inc    /foo/'], 'Xdir1/dir2/baz.b')
+  call writefile(['%inc    /foo/'], 'Xbase.b')
+
+  let &include='^\s*%inc\s*/\zs[^/]\+\ze'
+  let &includeexpr='DotsToSlashes()'
+
+  edit Xbase.b
+  set path=Xdir1/dir2
+  let res = split(execute("checkpath!"), "\n")
+  call assert_equal([
+             \ '--- Included files in path ---',
+             \ 'Xdir1/dir2/foo.b',
+             \ 'Xdir1/dir2/foo.b -->',
+             \ '  Xdir1/dir2/bar.b',
+             \ '  Xdir1/dir2/bar.b -->',
+             \ '    Xdir1/dir2/baz.b',
+             \ '    Xdir1/dir2/baz.b -->',
+             \ '      foo  (Already listed)'], res)
+
+  enew
+  call delete("./Xbase.b")
+  call delete("Xdir1", "rf")
+  set path&
+  set include&
+  set includeexpr&
+endfunc
+
+func StripNewlineChar()
+  if v:fname =~ '\n$'
+    return v:fname[:-2]
+  endif
+  return v:fname
+endfunc
+
+" Test for 'include' with \zs and no \ze
+func Test_checkpath3()
+  call mkdir("Xdir1/dir2", "p")
+  call writefile(['%inc    bar.c'], 'Xdir1/dir2/foo.c')
+  call writefile(['%inc    baz.c'], 'Xdir1/dir2/bar.c')
+  call writefile(['%inc    foo.c'], 'Xdir1/dir2/baz.c')
+  call writefile(['%inc    foo.c'], 'Xdir1/dir2/FALSE.c')
+  call writefile(['%inc    FALSE.c foo.c'], 'Xbase.c')
+
+  let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze'
+  let &includeexpr='StripNewlineChar()'
+
+  edit Xbase.c
+  set path=Xdir1/dir2
+  let res = split(execute("checkpath!"), "\n")
+  call assert_equal([
+             \ '--- Included files in path ---',
+             \ 'Xdir1/dir2/foo.c',
+             \ 'Xdir1/dir2/foo.c -->',
+             \ '  Xdir1/dir2/bar.c',
+             \ '  Xdir1/dir2/bar.c -->',
+             \ '    Xdir1/dir2/baz.c',
+             \ '    Xdir1/dir2/baz.c -->',
+             \ '      foo.c  (Already listed)'], res)
+
+  enew
+  call delete("./Xbase.c")
+  call delete("Xdir1", "rf")
+  set path&
+  set include&
+  set includeexpr&
+endfunc
index d233046d2b07b51019957de4f9e0c89f3cfe917d..accd21e9a379b1b1cb79b8e702be019f394c7264 100644 (file)
@@ -64,3 +64,38 @@ func Test_gF()
   bwipe Xfile
   bwipe Xfile2
 endfunc
+
+" Test for invoking 'gf' on a ${VAR} variable
+func Test_gf()
+  if has("ebcdic")
+    set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,}
+  else
+    set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,}
+  endif
+
+  call writefile(["Test for gf command"], "Xtest1")
+  if has("unix")
+    call writefile(["    ${CDIR}/Xtest1"], "Xtestgf")
+  else
+    call writefile(["    $TDIR/Xtest1"], "Xtestgf")
+  endif
+  new Xtestgf
+  if has("unix")
+    let $CDIR = "."
+    /CDIR
+  else
+    if has("amiga")
+      let $TDIR = "/testdir"
+    else
+      let $TDIR = "."
+    endif
+    /TDIR
+  endif
+
+  normal gf
+  call assert_equal('Xtest1', fnamemodify(bufname(''), ":t"))
+  close!
+
+  call delete('Xtest1')
+  call delete('Xtestgf')
+endfunc
index bb310e2d066c712226ab5d1ad7fa2e3e3776a023..f4344aa3875a8fe1880a3a1b9c74c837266c8a58 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1285,
 /**/
     1284,
 /**/