patch 9.0.1627: no generic mechanism to test syntax plugins

Problem:    No generic mechanism to test syntax plugins.
Solution:   Add a syntax plugin test mechanism, using screendumps.  Add a
            simple test for "c".
This commit is contained in:
Bram Moolenaar
2023-06-11 19:04:18 +01:00
parent 10e8ff9b26
commit 46acad7284
15 changed files with 542 additions and 2 deletions

View File

@ -805,6 +805,11 @@ RT_SCRIPTS = \
runtime/syntax/README.txt \
runtime/syntax/shared/*.vim \
runtime/syntax/shared/README.txt \
runtime/syntax/Makefile \
runtime/syntax/testdir/README.txt \
runtime/syntax/testdir/runtest.vim \
runtime/syntax/testdir/input/*.* \
runtime/syntax/testdir/dumps/*.dump \
# Unix runtime
RT_UNIX = \

View File

@ -39,14 +39,17 @@ all install uninstall tools config configure reconfig proto depend lint tags typ
@echo "Starting make in the src directory."
@echo "If there are problems, cd to the src directory and run make there"
cd src && $(MAKE) $@
@# When the target is "test" also run the indent tests.
@# When the target is "test" also run the indent and syntax tests.
@if test "$@" = "test"; then \
$(MAKE) indenttest; \
$(MAKE) syntaxtest; \
fi
@# When the target is "clean" also clean for the indent tests.
@# When the target is "clean" also clean for the indent and syntax tests.
@if test "$@" = "clean" -o "$@" = "distclean" -o "$@" = "testclean"; then \
cd runtime/indent && \
$(MAKE) clean; \
cd runtime/syntax && \
$(MAKE) clean; \
fi
# Executable used for running the indent tests.
@ -57,6 +60,14 @@ indenttest:
$(MAKE) clean && \
$(MAKE) test VIM="$(VIM_FOR_INDENTTEST)"
# Executable used for running the syntax tests.
VIM_FOR_SYNTAXTEST = ../../src/vim
syntaxtest:
cd runtime/syntax && \
$(MAKE) clean && \
$(MAKE) test VIM="$(VIM_FOR_SYNTAXTEST)"
#########################################################################
# 2. Creating the various distribution files.

27
runtime/syntax/Makefile Normal file
View File

@ -0,0 +1,27 @@
# Portable Makefile for running syntax tests.
# Override this if needed, e.g. with ../../src/vim
VIMPROG = vim
# "runtime" relative to "runtime/syntax/testdir"
VIMRUNTIME = ../..
# Uncomment this line to use valgrind for memory leaks and extra warnings.
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=45 --log-file=valgrind.$*
# ENVVARS = LC_ALL=C LANG=C LANGUAGE=C
RUN_VIMTEST = VIMRUNTIME=$(VIMRUNTIME) $(VALGRIND) $(ENVVARS) $(VIMPROG) -f $(GUI_FLAG)
# Run the tests that didn't run yet or failed previously.
# If a test succeeds a testdir/done/{name} file will be written.
# If a test fails a testdir/failed/{name}.dump file will be written.
test:
@# the "vimcmd" file is used by the screendump utils
@echo "$(VIMPROG)" > testdir/vimcmd
@echo "$(RUN_VIMTEST)" >> testdir/vimcmd
VIMRUNTIME=$(VIMRUNTIME) $(VIMPROG) --clean --not-a-term -u testdir/runtest.vim
clean testclean:
rm -f testdir/failed/* testdir/done/* testdir/vimcmd

View File

@ -0,0 +1,97 @@
Tests for syntax highlighting plugins
=====================================
Summary: Files in the "input" directory are edited by Vim with syntax
highlighting enabled. Screendumps are generated and compared with the
expected screendumps in the "dumps" directory. This will uncover any
character attributes that differ.
Without any further setup a screendump is made at the top of the file (using
_00.dump) and another one at the end of the file (using _99.dump). The dumps
are normally 20 screen lines tall.
When the screendumps are OK an empty "done/{name}" file is created. This
avoids running the test again until "make clean" is used. Thus you can run
"make test", see one test fail, try to fix the problem, then run "make test"
again to only repeat the failing test.
When a screendump differs it is stored in the "failed" directory. This allows
for comparing it with the expected screendump, using a command like:
let fname = '{name}_99.dump'
call term_dumpdiff('failed/' .. fname, 'dumps/' .. fname)
Creating a syntax plugin test
-----------------------------
Create a source file in the language you want to test in the "input"
directory. Make sure to include some interesting constructs with complicated
highlighting.
Use the filetype name as the base and a file name extension matching the
filetype. Let's use Java as an example. The file would then be
"input/java.java".
If there is no further setup required, you can now run the tests:
make test
The first time this will fail with an error for a missing screendump. The
newly created screendumps will be "failed/java_00.dump",
"failed/java_01.dump", etc. You can inspect each with:
call term_dumpload('failed/java_00.dump')
call term_dumpload('failed/java_01.dump')
...
call term_dumpload('failed/java_99.dump')
If they look OK, move them to the "dumps" directory:
:!mv failed/java_00.dump dumps
:!mv failed/java_01.dump dumps
...
:!mv failed/java_99.dump dumps
If you now run the test again, it will succeed.
Adjusting a syntax plugin test
------------------------------
If you make changes to the syntax plugin, you should add code to the input
file to see the effect of these changes. So that the effect of the changes
are covered by the test. You can follow these steps:
1. Edit the syntax plugin somewhere in your personal setup. Use a file
somewhere to try out the changes.
2. Go to the directory where you have the Vim code checked out and replace the
syntax plugin. Run the tests: "make test". Usually the tests will still
pass, but if you fixed syntax highlighting that was already visible in the
input file, carefully check that the changes in the screendump are
intentional:
let fname = '{name}_99.dump'
call term_dumpdiff('failed/' .. fname, 'dumps/' .. fname)
Fix the syntax plugin until the result is good.
2. Edit the input file for your language to add the items you have improved.
(TODO: how to add another screendump?).
Run the tests and you should get failures. Like with the previous step,
carefully check that the new screendumps in the "failed" directory are
good. Update the syntax plugin and the input file until the highlighting
is good and you can see the effect of the syntax plugin improvements. Then
move the screendumps from the "failed" to the "dumps" directory. Now "make
test" should succeed.
3. Prepare a pull request with the modified files:
- syntax plugin: syntax/{name}.vim
- test input file: syntax/testdir/input/{name}.{ext}
- test dump files: syntax/testdir/dumps/{name}_99.dump
As an extra check you can temporarily put back the old syntax plugin and
verify that the tests fail. Then you know your changes are covered by the
test.
TODO: run test for one specific filetype
TODO: testing with various option values
TODO: test syncing by jumping around

View File

@ -0,0 +1,20 @@
>/+0#0000e05#ffffff0|*| |v|i|:|s|e|t| |t|s|=|8+0#e000002&| +0#0000e05&|s|t|s|=|4+0#e000002&| +0#0000e05&|s|w|=|4+0#e000002&| +0#0000e05&|n|o|e|t|:| +0#0000000&@43
| +0#0000e05&|*| +0#0000000&@72
| +0#0000e05&|*| |V|I|M| |-| |V|i| |I|M|p|r|o|v|e|d| @3|b|y| |B|r|a|m| |M|o@1|l|e|n|a@1|r| +0#0000000&@33
| +0#0000e05&|*| +0#0000000&@72
| +0#0000e05&|*| |D|o| |"+0#e000002&|:|h|e|l|p| |u|g|a|n|d|a|"| +0#0000e05&@1|i|n| |V|i|m| |t|o| |r|e|a|d| |c|o|p|y|i|n|g| |a|n|d| |u|s|a|g|e| |c|o|n|d|i|t|i|o|n|s|.| +0#0000000&@8
| +0#0000e05&|*| |D|o| |"+0#e000002&|:|h|e|l|p| |c|r|e|d|i|t|s|"| +0#0000e05&|i|n| |V|i|m| |t|o| |s|e@1| |a| |l|i|s|t| |o|f| |p|e|o|p|l|e| |w|h|o| |c|o|n|t|r|i|b|u|t|e|d|.| +0#0000000&@5
| +0#0000e05&|*| |S|e@1| |R|E|A|D|M|E|.|t|x|t| |f|o|r| |a|n| |o|v|e|r|v|i|e|w| |o|f| |t|h|e| |V|i|m| |s|o|u|r|c|e| |c|o|d|e|.| +0#0000000&@17
| +0#0000e05&|*|/| +0#0000000&@71
@75
|#+0#e000e06&|d|e|f|i|n|e| |E|X|T|E|R|N| +0#0000000&@60
|#+0#e000e06&|i|n|c|l|u|d|e| |"+0#e000002&|v|i|m|.|h|"| +0#0000000&@58
@75
|#+0#e000e06&|i|f|d|e|f| |_@1|C|Y|G|W|I|N|_@1| +0#0000000&@57
|#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|c|y|g|w|i|n|/|v|e|r|s|i|o|n|.|h|>| +0#0000000&@46
|#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|s|y|s|/|c|y|g|w|i|n|.|h|>| +0#0000000&@7|/+0#0000e05&@1| |f|o|r| |c|y|g|w|i|n|_|c|o|n|v|_|t|o|_|p|o|s|i|x|_|p|a|t|h|(|)| |a|n|d|/|o|r| +0#0000000&@1
@32|/+0#0000e05&@1| |c|y|g|w|i|n|_|c|o|n|v|_|p|a|t|h|(|)| +0#0000000&@21
|#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|l|i|m|i|t|s|.|h|>| +0#0000000&@54
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
@75
|"|i|n|p|u|t|/|c|.|c|"| |1|2@1|L|,| |3|1|7|4|B| @33|1|,|1| @10|T|o|p|

View File

@ -0,0 +1,20 @@
|#+0#e000e06#ffffff0| |i|n|c|l|u|d|e| |<+0#e000002&|c|y|g|w|i|n|/|v|e|r|s|i|o|n|.|h|>| +0#0000000&@46
|#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|s|y|s|/|c|y|g|w|i|n|.|h|>| +0#0000000&@7|/+0#0000e05&@1| |f|o|r| |c|y|g|w|i|n|_|c|o|n|v|_|t|o|_|p|o|s|i|x|_|p|a|t|h|(|)| |a|n|d|/|o|r| +0#0000000&@1
@32|/+0#0000e05&@1| |c|y|g|w|i|n|_|c|o|n|v|_|p|a|t|h|(|)| +0#0000000&@21
|#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|l|i|m|i|t|s|.|h|>| +0#0000000&@54
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
> @74
|#+0#e000e06&|i|f| |d|e|f|i|n|e|d|(|M|S|W|I|N|)| |&@1| |(|!|d|e|f|i|n|e|d|(|F|E|A|T|_|G|U|I|_|M|S|W|I|N|)| ||@1| |d|e|f|i|n|e|d|(|V|I|M|D|L@1|)@1| +0#0000000&@7
|#+0#e000e06&| |i|n|c|l|u|d|e| |"+0#e000002&|i|s|c|y|g|p|t|y|.|h|"| +0#0000000&@52
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
@75
|/+0#0000e05&@1| |V|a|l|u|e|s| |f|o|r| |e|d|i|t|_|t|y|p|e|.| +0#0000000&@50
|#+0#e000e06&|d|e|f|i|n|e| |E|D|I|T|_|N|O|N|E| @2|0+0#e000002&| +0#e000e06&@6|/+0#0000e05&@1| |n|o| |e|d|i|t| |t|y|p|e| |y|e|t| +0#0000000&@27
|#+0#e000e06&|d|e|f|i|n|e| |E|D|I|T|_|F|I|L|E| @2|1+0#e000002&| +0#e000e06&@6|/+0#0000e05&@1| |f|i|l|e| |n|a|m|e| |a|r|g|u|m|e|n|t|[|s|]| |g|i|v|e|n|,| |u|s|e| |a|r|g|u|m|e|n|t| |l|i
|s|t| +0#0000000&@72
|#+0#e000e06&|d|e|f|i|n|e| |E|D|I|T|_|S|T|D|I|N| @1|2+0#e000002&| +0#e000e06&@6|/+0#0000e05&@1| |r|e|a|d| |f|i|l|e| |f|r|o|m| |s|t|d|i|n| +0#0000000&@23
|#+0#e000e06&|d|e|f|i|n|e| |E|D|I|T|_|T|A|G| @3|3+0#e000002&| +0#e000e06&@6|/+0#0000e05&@1| |t|a|g| |n|a|m|e| |a|r|g|u|m|e|n|t| |g|i|v|e|n|,| |u|s|e| |t|a|g|n|a|m|e| +0#0000000&@7
|#+0#e000e06&|d|e|f|i|n|e| |E|D|I|T|_|Q|F| @4|4+0#e000002&| +0#e000e06&@6|/+0#0000e05&@1| |s|t|a|r|t| |i|n| |q|u|i|c|k|f|i|x| |m|o|d|e| +0#0000000&@21
@75
|#+0#e000e06&|i|f| |(|d|e|f|i|n|e|d|(|U|N|I|X|)| ||@1| |d|e|f|i|n|e|d|(|V|M|S|)@1| |&@1| |!|d|e|f|i|n|e|d|(|N|O|_|V|I|M|_|M|A|I|N|)| +0#0000000&@14
@57|1|9|,|0|-|1| @7|1|2|%|

View File

@ -0,0 +1,20 @@
|s+0#00e0003#ffffff0|t|a|t|i|c| +0#0000000&|i+0#00e0003&|n|t| +0#0000000&|f|i|l|e|_|o|w|n|e|d|(|c+0#00e0003&|h|a|r| +0#0000000&|*|f|n|a|m|e|)|;| @39
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|m|a|i|n|e|r@1|(|i+0#00e0003&|n|t|,+0#0000000&| |c|h|a|r|_|u| |*|)|;| @39
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|e|a|r|l|y|_|a|r|g|_|s|c|a|n|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @31
|#+0#e000e06&|i|f|n|d|e|f| |N|O|_|V|I|M|_|M|A|I|N| +0#0000000&@55
>s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|u|s|a|g|e|(|v+0#00e0003&|o|i|d|)+0#0000000&|;| @50
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|p|a|r|s|e|_|c|o|m@1|a|n|d|_|n|a|m|e|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @27
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|c|o|m@1|a|n|d|_|l|i|n|e|_|s|c|a|n|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @28
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|c|h|e|c|k|_|t@1|y|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @36
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|r|e|a|d|_|s|t|d|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&|;| @45
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|c|r|e|a|t|e|_|w|i|n|d|o|w|s|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @31
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|e|d|i|t|_|b|u|f@1|e|r|s|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|,| |c|h|a|r|_|u| |*|c|w|d|)|;| @20
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|e|x|e|_|p|r|e|_|c|o|m@1|a|n|d|s|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @29
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|e|x|e|_|c|o|m@1|a|n|d|s|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @33
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|s|o|u|r|c|e|_|s|t|a|r|t|u|p|_|s|c|r|i|p|t|s|(|m|p|a|r|m|_|T| |*|p|a|r|m|p|)|;| @23
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|m|a|i|n|_|s|t|a|r|t|_|g|u|i|(|v+0#00e0003&|o|i|d|)+0#0000000&|;| @41
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|c|h|e|c|k|_|s|w|a|p|_|e|x|i|s|t|s|_|a|c|t|i|o|n|(|v+0#00e0003&|o|i|d|)+0#0000000&|;| @31
|#+0#e000e06&| |i|f|d|e|f| |F|E|A|T|_|E|V|A|L| +0#0000000&@57
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|s|e|t|_|p|r|o|g|p|a|t|h|(|c|h|a|r|_|u| |*|a|r|g|v|0|)|;| @34
@57|3|7|,|1| @9|3|0|%|

View File

@ -0,0 +1,20 @@
|s+0#00e0003#ffffff0|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|s|e|t|_|p|r|o|g|p|a|t|h|(|c|h|a|r|_|u| |*|a|r|g|v|0|)|;| @34
|#+0#e000e06&| |e|n|d|i|f| +0#0000000&@67
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
@75
@75
>/+0#0000e05&|*| +0#0000000&@72
| +0#0000e05&|*| |D|i|f@1|e|r|e|n|t| |t|y|p|e|s| |o|f| |e|r@1|o|r| |m|e|s@1|a|g|e|s|.| +0#0000000&@37
| +0#0000e05&|*|/| +0#0000000&@71
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|c+0#00e0003&|h|a|r| +0#0000000&|*|(|m|a|i|n|_|e|r@1|o|r|s|[|]|)| |=| @44
|{| @73
@4|N|_|(|"+0#e000002&|U|n|k|n|o|w|n| |o|p|t|i|o|n| |a|r|g|u|m|e|n|t|"|)+0#0000000&|,| @40
|#+0#e000e06&|d|e|f|i|n|e| |M|E|_|U|N|K|N|O|W|N|_|O|P|T|I|O|N| @6|0+0#e000002&| +0#0000000&@41
@4|N|_|(|"+0#e000002&|T|o@1| |m|a|n|y| |e|d|i|t| |a|r|g|u|m|e|n|t|s|"|)+0#0000000&|,| @40
|#+0#e000e06&|d|e|f|i|n|e| |M|E|_|T|O@1|_|M|A|N|Y|_|A|R|G|S| @7|1+0#e000002&| +0#0000000&@41
@4|N|_|(|"+0#e000002&|A|r|g|u|m|e|n|t| |m|i|s@1|i|n|g| |a|f|t|e|r|"|)+0#0000000&|,| @41
|#+0#e000e06&|d|e|f|i|n|e| |M|E|_|A|R|G|_|M|I|S@1|I|N|G| @9|2+0#e000002&| +0#0000000&@41
@4|N|_|(|"+0#e000002&|G|a|r|b|a|g|e| |a|f|t|e|r| |o|p|t|i|o|n| |a|r|g|u|m|e|n|t|"|)+0#0000000&|,| @34
|#+0#e000e06&|d|e|f|i|n|e| |M|E|_|G|A|R|B|A|G|E| @13|3+0#e000002&| +0#0000000&@41
|@+0#4040ff13&@2| @71
| +0#0000000&@56|5@1|,|1| @9|4|7|%|

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@3|N|_|(|"+0#e000002&|T|o@1| |m|a|n|y| |\+0#e000e06&|"|++0#e000002&|c|o|m@1|a|n|d|\+0#e000e06&|"|,+0#e000002&| |\+0#e000e06&|"|-+0#e000002&|c| |c|o|m@1|a|n|d|\+0#e000e06&|"| +0#e000002&|o|r| |\+0#e000e06&|"|-+0#e000002&@1|c|m|d| |c|o|m@1|a|n|d|\+0#e000e06&|"| +0#e000002&|a|r|g|u|m|e|n|t
|s|"|)+0#0000000&|,| @70
|#+0#e000e06&|d|e|f|i|n|e| |M|E|_|E|X|T|R|A|_|C|M|D| @11|4+0#e000002&| +0#0000000&@41
@4|N|_|(|"+0#e000002&|I|n|v|a|l|i|d| |a|r|g|u|m|e|n|t| |f|o|r|"|)+0#0000000&|,| @43
|#+0#e000e06&|d|e|f|i|n|e| |M|E|_|I|N|V|A|L|I|D|_|A|R|G| @9|5+0#e000002&| +0#0000000&@41
|}|;| @72
> @74
|#+0#e000e06&|i|f|n|d|e|f| |P|R|O|T|O| @10|/+0#0000e05&@1| |d|o|n|'|t| |w|a|n|t| |a| |p|r|o|t|o|t|y|p|e| |f|o|r| |m|a|i|n|(|)| +0#0000000&@14
@75
|/+0#0000e05&@1| |V|a|r|i|o|u|s| |p|a|r|a|m|e|t|e|r|s| |p|a|s@1|e|d| |b|e|t|w|e@1|n| |m|a|i|n|(|)| |a|n|d| |o|t|h|e|r| |f|u|n|c|t|i|o|n|s|.| +0#0000000&@10
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|m|p|a|r|m|_|T| @1|p|a|r|a|m|s|;| @51
@75
|#+0#e000e06&|i|f|d|e|f| |_|I|O|L|B|F| +0#0000000&@61
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|*|s|_|v|b|u|f| |=| |N+0#e000002&|U|L@1|;+0#0000000&| @12|/+0#0000e05&@1| |b|u|f@1|e|r| |f|o|r| |s|e|t|v|b|u|f|(|)| +0#0000000&@11
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
@75
|#+0#e000e06&|i|f|n|d|e|f| |N|O|_|V|I|M|_|M|A|I|N| @4|/+0#0000e05&@1| |s|k|i|p| |t|h|i|s| |f|o|r| |u|n|i|t@1|e|s|t|s| +0#0000000&@24
@75
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|c|h|a|r|_|u| |*|s|t|a|r|t|_|d|i|r| |=| |N+0#e000002&|U|L@1|;+0#0000000&| @7|/+0#0000e05&@1| |c|u|r@1|e|n|t| |w|o|r|k|i|n|g| |d|i|r| |o|n| |s|t|a|r|t|u|p| +0#0000000&@1
@57|7|3|,|0|-|1| @7|6|4|%|

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@74
|s+0#00e0003&|t|a|t|i|c| +0#0000000&|i+0#00e0003&|n|t| +0#0000000&|h|a|s|_|d|a|s|h|_|c|_|a|r|g| |=| |F|A|L|S|E|;| @40
@75
|#+0#e000e06&| |i|f|d|e|f| |V|I|M|D|L@1| +0#0000000&@60
|_@1|d|e|c|l|s|p|e|c|(|d|l@1|e|x|p|o|r|t|)| @53
>#+0#e000e06&| |e|n|d|i|f| +0#0000000&@67
@4|i+0#00e0003&|n|t| +0#0000000&@67
|#+0#e000e06&| |i|f|d|e|f| |M|S|W|I|N| +0#0000000&@61
|V|i|m|M|a|i|n| @67
|#+0#e000e06&| |e|l|s|e| +0#0000000&@68
|m|a|i|n| @70
|#+0#e000e06&| |e|n|d|i|f| +0#0000000&@67
|(|i+0#00e0003&|n|t| +0#0000000&|a|r|g|c|,| |c+0#00e0003&|h|a|r| +0#0000000&|*@1|a|r|g|v|)| @51
|{| @73
|#+0#e000e06&|i|f| |d|e|f|i|n|e|d|(|S|T|A|R|T|U|P|T|I|M|E|)| ||@1| |d|e|f|i|n|e|d|(|C|L|E|A|N|_|R|U|N|T|I|M|E|P|A|T|H|)| +0#0000000&@20
@4|i+0#00e0003&|n|t| +0#0000000&@8|i|;| @56
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
@75
@4|/+0#0000e05&|*| +0#0000000&@68
@57|9|1|,|1| @9|8|2|%|

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@3|/+0#0000e05&|*| +0#0000000&@68
| +0#0000e05&@4|*| |D|o| |a|n|y| |s|y|s|t|e|m|-|s|p|e|c|i|f|i|c| |i|n|i|t|i|a|l|i|s|a|t|i|o|n|s|.| @1|T|h|e|s|e| |c|a|n| |N|O|T| |u|s|e| |I|O|b|u|f@1| |o|r
| @4|*| |N|a|m|e|B|u|f@1|.| @1|T|h|u|s| |e|m|s|g|2|(|)| |c|a|n@1|o|t| |b|e| |c|a|l@1|e|d|!| +0#0000000&@26
| +0#0000e05&@4|*|/| +0#0000000&@67
@4|m|c|h|_|e|a|r|l|y|_|i|n|i|t|(|)|;| @53
> @74
@4|/+0#0000e05&@1| |S|o|u|r|c|e| |s|t|a|r|t|u|p| |s|c|r|i|p|t|s|.| +0#0000000&@44
@4|s|o|u|r|c|e|_|s|t|a|r|t|u|p|_|s|c|r|i|p|t|s|(|&|p|a|r|a|m|s|)|;| @38
@75
|#+0#e000e06&|i|f| |0| +0#0000000&@69
| +0#0000e05&@3|/|*| +0#0000000&@68
| +0#0000e05&@4|*| |N|e|w|e|r| |v|e|r|s|i|o|n| |o|f| |M|z|S|c|h|e|m|e| |(|R|a|c|k|e|t|)| |r|e|q|u|i|r|e| |e|a|r|l|i|e|r| |(|t|r|a|m|p|o|l|i|n|e|d|)| +0#0000000&@3
| +0#0000e05&@4|*| |i|n|i|t|i|a|l|i|s|a|t|i|o|n| |v|i|a| |s|c|h|e|m|e|_|m|a|i|n|_|s|e|t|u|p|.| +0#0000000&@30
| +0#0000e05&@4|*|/| +0#0000000&@67
| +0#0000e05&@3|r|e|t|u|r|n| |m|z|s|c|h|e|m|e|_|m|a|i|n|(|)|;| +0#0000000&@47
|#+0#e000e06&|e|l|s|e| +0#0000000&@69
@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|v|i|m|_|m|a|i|n|2|(|)|;| @51
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
|}| @73
@57|1|0|9|,|0|-|1| @6|B|o|t|

View File

@ -0,0 +1,20 @@
| +0&#ffffff0@3|/+0#0000e05&|*| +0#0000000&@68
| +0#0000e05&@4|*| |D|o| |a|n|y| |s|y|s|t|e|m|-|s|p|e|c|i|f|i|c| |i|n|i|t|i|a|l|i|s|a|t|i|o|n|s|.| @1|T|h|e|s|e| |c|a|n| |N|O|T| |u|s|e| |I|O|b|u|f@1| |o|r
| @4|*| |N|a|m|e|B|u|f@1|.| @1|T|h|u|s| |e|m|s|g|2|(|)| |c|a|n@1|o|t| |b|e| |c|a|l@1|e|d|!| +0#0000000&@26
| +0#0000e05&@4|*|/| +0#0000000&@67
@4|m|c|h|_|e|a|r|l|y|_|i|n|i|t|(|)|;| @53
@75
@4|/+0#0000e05&@1| |S|o|u|r|c|e| |s|t|a|r|t|u|p| |s|c|r|i|p|t|s|.| +0#0000000&@44
@4|s|o|u|r|c|e|_|s|t|a|r|t|u|p|_|s|c|r|i|p|t|s|(|&|p|a|r|a|m|s|)|;| @38
@75
|#+0#e000e06&|i|f| |0| +0#0000000&@69
| +0#0000e05&@3|/|*| +0#0000000&@68
| +0#0000e05&@4|*| |N|e|w|e|r| |v|e|r|s|i|o|n| |o|f| |M|z|S|c|h|e|m|e| |(|R|a|c|k|e|t|)| |r|e|q|u|i|r|e| |e|a|r|l|i|e|r| |(|t|r|a|m|p|o|l|i|n|e|d|)| +0#0000000&@3
| +0#0000e05&@4|*| |i|n|i|t|i|a|l|i|s|a|t|i|o|n| |v|i|a| |s|c|h|e|m|e|_|m|a|i|n|_|s|e|t|u|p|.| +0#0000000&@30
| +0#0000e05&@4|*|/| +0#0000000&@67
| +0#0000e05&@3|r|e|t|u|r|n| |m|z|s|c|h|e|m|e|_|m|a|i|n|(|)|;| +0#0000000&@47
|#+0#e000e06&|e|l|s|e| +0#0000000&@69
@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|v|i|m|_|m|a|i|n|2|(|)|;| @51
|#+0#e000e06&|e|n|d|i|f| +0#0000000&@68
>}| @73
@57|1|2@1|,|1| @8|B|o|t|

View File

@ -0,0 +1,122 @@
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#define EXTERN
#include "vim.h"
#ifdef __CYGWIN__
# include <cygwin/version.h>
# include <sys/cygwin.h> // for cygwin_conv_to_posix_path() and/or
// cygwin_conv_path()
# include <limits.h>
#endif
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
# include "iscygpty.h"
#endif
// Values for edit_type.
#define EDIT_NONE 0 // no edit type yet
#define EDIT_FILE 1 // file name argument[s] given, use argument list
#define EDIT_STDIN 2 // read file from stdin
#define EDIT_TAG 3 // tag name argument given, use tagname
#define EDIT_QF 4 // start in quickfix mode
#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN)
static int file_owned(char *fname);
#endif
static void mainerr(int, char_u *);
static void early_arg_scan(mparm_T *parmp);
#ifndef NO_VIM_MAIN
static void usage(void);
static void parse_command_name(mparm_T *parmp);
static void command_line_scan(mparm_T *parmp);
static void check_tty(mparm_T *parmp);
static void read_stdin(void);
static void create_windows(mparm_T *parmp);
static void edit_buffers(mparm_T *parmp, char_u *cwd);
static void exe_pre_commands(mparm_T *parmp);
static void exe_commands(mparm_T *parmp);
static void source_startup_scripts(mparm_T *parmp);
static void main_start_gui(void);
static void check_swap_exists_action(void);
# ifdef FEAT_EVAL
static void set_progpath(char_u *argv0);
# endif
#endif
/*
* Different types of error messages.
*/
static char *(main_errors[]) =
{
N_("Unknown option argument"),
#define ME_UNKNOWN_OPTION 0
N_("Too many edit arguments"),
#define ME_TOO_MANY_ARGS 1
N_("Argument missing after"),
#define ME_ARG_MISSING 2
N_("Garbage after option argument"),
#define ME_GARBAGE 3
N_("Too many \"+command\", \"-c command\" or \"--cmd command\" arguments"),
#define ME_EXTRA_CMD 4
N_("Invalid argument for"),
#define ME_INVALID_ARG 5
};
#ifndef PROTO // don't want a prototype for main()
// Various parameters passed between main() and other functions.
static mparm_T params;
#ifdef _IOLBF
static void *s_vbuf = NULL; // buffer for setvbuf()
#endif
#ifndef NO_VIM_MAIN // skip this for unittests
static char_u *start_dir = NULL; // current working dir on startup
static int has_dash_c_arg = FALSE;
# ifdef VIMDLL
__declspec(dllexport)
# endif
int
# ifdef MSWIN
VimMain
# else
main
# endif
(int argc, char **argv)
{
#if defined(STARTUPTIME) || defined(CLEAN_RUNTIMEPATH)
int i;
#endif
/*
* Do any system-specific initialisations. These can NOT use IObuff or
* NameBuff. Thus emsg2() cannot be called!
*/
mch_early_init();
// Source startup scripts.
source_startup_scripts(&params);
#if 0
/*
* Newer version of MzScheme (Racket) require earlier (trampolined)
* initialisation via scheme_main_setup.
*/
return mzscheme_main();
#else
return vim_main2();
#endif
}

View File

@ -0,0 +1,116 @@
" Runs all the syntax tests for which there is no "done/name" file.
"
" Current directory must be runtime/syntax.
" Only do this with the +eval feature
if 1
let cwd = getcwd()
if cwd !~ '[/\\]runtime[/\\]syntax\>'
echoerr 'Current directory must be "runtime/syntax"'
qall
endif
if !isdirectory('testdir')
echoerr '"testdir" directory not found'
qall
endif
" Use the script for source code screendump testing. It sources other scripts,
" therefore we must "cd" there.
cd ../../src/testdir
source screendump.vim
exe 'cd ' .. fnameescape(cwd)
" For these tests we need to be able to run terminal Vim with 256 colors. On
" MS-Windows the console only has 16 colors and the GUI can't run in a
" terminal.
if !CanRunVimInTerminal()
echomsg 'Cannot make screendumps, aborting'
qall
endif
cd testdir
if !isdirectory('done')
call mkdir('done')
endif
set nocp
set nowrapscan
set report=9999
set modeline
set debug=throw
set nomore
au! SwapExists * call HandleSwapExists()
func HandleSwapExists()
" Ignore finding a swap file for the test input, the user might be editing
" it and that's OK.
if expand('<afile>') =~ 'input[/\\].*\..*'
let v:swapchoice = 'e'
endif
endfunc
let failed_count = 0
for fname in glob('input/*.*', 1, 1)
if fname =~ '\~$'
" backup file, skip
continue
endif
let linecount = readfile(fname)->len()
let root = substitute(fname, 'input[/\\]\(.*\)\..*', '\1', '')
" Execute the test if the "done" file does not exist of when the input file
" is newer.
let in_time = getftime(fname)
let out_time = getftime('done/' .. root)
if out_time < 0 || in_time > out_time
for dumpname in glob('failed/' .. root .. '_\d*\.dump', 1, 1)
call delete(dumpname)
endfor
call delete('done/' .. root)
let lines =<< trim END
syntax on
END
call writefile(lines, 'Xtestscript')
let buf = RunVimInTerminal('-S Xtestscript ' .. fname, {})
" Screendump at the start of the file: root_00.dump
let fail = VerifyScreenDump(buf, root .. '_00', {})
" Make a Screendump every 18 lines of the file: root_NN.dump
let topline = 1
let nr = 1
while linecount - topline > 20
let topline += 18
call term_sendkeys(buf, printf("%dGzt", topline))
let fail += VerifyScreenDump(buf, root .. printf('_%02d', nr), {})
let nr += 1
endwhile
" Screendump at the end of the file: root_99.dump
call term_sendkeys(buf, 'Gzb')
let fail += VerifyScreenDump(buf, root .. '_99', {})
call StopVimInTerminal(buf)
call delete('Xtestscript')
if fail == 0
call writefile(['OK'], 'done/' . root)
echo "Test " . root . " OK\n"
else
let failed_count += 1
endif
endif
endfor
" Matching "if 1" at the start.
endif
if failed_count > 0
" have make report an error
cquit
endif
qall!

View File

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