summaryrefslogtreecommitdiff
path: root/test/test_c_flag_parsing.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_c_flag_parsing.vader')
-rw-r--r--test/test_c_flag_parsing.vader122
1 files changed, 61 insertions, 61 deletions
diff --git a/test/test_c_flag_parsing.vader b/test/test_c_flag_parsing.vader
index 4329b573..4204d8ea 100644
--- a/test/test_c_flag_parsing.vader
+++ b/test/test_c_flag_parsing.vader
@@ -23,11 +23,11 @@ After:
call ale#test#RestoreDirectory()
Execute(The make command should be correct):
- call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+ call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
AssertEqual
\ [
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'make -n --always-make',
\ ],
\ ale#c#GetMakeCommand(bufnr(''))
@@ -37,26 +37,26 @@ Execute(The make command should be correct):
AssertEqual
\ [
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'make -n',
\ ],
\ ale#c#GetMakeCommand(bufnr(''))
Execute(Should recognize GNUmakefile as a makefile):
- call ale#test#SetFilename('test_c_projects/gnumakefile_project/file.c')
+ call ale#test#SetFilename('test-files/c/gnumakefile_project/file.c')
AssertEqual
\ [
- \ ale#path#Simplify(g:dir. '/test_c_projects/gnumakefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/gnumakefile_project'),
\ 'make -n --always-make',
\ ],
\ ale#c#GetMakeCommand(bufnr(''))
Execute(The CFlags parser should be able to parse include directives):
- call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+ call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
AssertEqual
- \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')),
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c'])
AssertEqual
@@ -64,43 +64,43 @@ Execute(The CFlags parser should be able to parse include directives):
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -isystem /usr/include/dir -c file.c'])
Execute(ParseCFlags should ignore -c and -o):
- call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+ call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
AssertEqual
- \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir')),
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c -o a.out'])
Execute(The CFlags parser should be able to parse macro directives):
- call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+ call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
AssertEqual
- \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
+ \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
\ . ' -DTEST=1',
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=1 -c file.c'])
Execute(The CFlags parser should be able to parse macro directives with spaces):
- call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+ call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
AssertEqual
- \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
+ \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
\ . ' -DTEST=$(( 2 * 4 ))',
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=$(( 2 * 4 )) -c file.c'])
Execute(The CFlags parser should be able to parse shell directives with spaces):
- call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+ call ale#test#SetFilename('test-files/c/makefile_project/subdir/file.c')
AssertEqual
- \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
+ \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
\ . ' -DTEST=`date +%s`',
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=`date +%s` -c file.c'])
Execute(ParseCFlags should be able to parse flags with relative paths):
AssertEqual
- \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
+ \ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include'))
\ . ' -DTEST=`date +%s`',
\ SplitAndParse(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'gcc -Isubdir '
\ . '-I'. ale#path#Simplify('kernel/include')
\ . ' -DTEST=`date +%s` -c file.c'
@@ -109,12 +109,12 @@ Execute(ParseCFlags should be able to parse flags with relative paths):
Execute(We should handle paths with spaces in double quotes):
AssertEqual
\ '-Dgoal=9'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include'))
\ . ' -DTEST=`date +%s`',
\ SplitAndParse(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
\ . '-I"dir with spaces"' . ' -I'. ale#path#Simplify('kernel/include')
\ . ' -DTEST=`date +%s` -c file.c'
@@ -123,12 +123,12 @@ Execute(We should handle paths with spaces in double quotes):
Execute(ParseCFlags should handle paths with spaces in single quotes):
AssertEqual
\ '-Dgoal=9'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include'))
\ . ' -DTEST=`date +%s`',
\ SplitAndParse(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
\ . '-I''dir with spaces''' . ' -I'. ale#path#Simplify('kernel/include')
\ . ' -DTEST=`date +%s` -c file.c'
@@ -137,13 +137,13 @@ Execute(ParseCFlags should handle paths with spaces in single quotes):
Execute(ParseCFlags should handle paths with minuses):
AssertEqual
\ '-Dgoal=9'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir-with-dash'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include'))
\ . ' -DTEST=`date +%s`',
\ SplitAndParse(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
\ . ' -I'. ale#path#Simplify('kernel/include')
@@ -153,14 +153,14 @@ Execute(ParseCFlags should handle paths with minuses):
Execute(We should handle -D with minuses):
AssertEqual
\ '-Dgoal=9'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
\ . ' -Dmacro-with-dash'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir-with-dash'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include'))
\ . ' -DTEST=`date +%s`',
\ SplitAndParse(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
\ . '-Dmacro-with-dash '
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
@@ -171,13 +171,13 @@ Execute(We should handle -D with minuses):
Execute(We should handle flags at the end of the line):
AssertEqual
\ '-Dgoal=9'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/subdir'))
\ . ' -Dmacro-with-dash'
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
- \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir with spaces'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/dir-with-dash'))
+ \ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/kernel/include')),
\ SplitAndParse(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
\ . '-Dmacro-with-dash '
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
@@ -489,14 +489,14 @@ Execute(ShellSplit should handle parenthesis and quotes):
Execute(We should include several important flags):
AssertEqual
- \ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/inc'))
- \ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include'))
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incquote'))
- \ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incsystem'))
- \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
- \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
- \ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
- \ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
+ \ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/inc'))
+ \ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/include'))
+ \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incquote'))
+ \ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incsystem'))
+ \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/incafter'))
+ \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incframework'))
+ \ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/foo bar'))
+ \ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incmacros'))
\ . ' -Dmacro="value"'
\ . ' -DGoal=9'
\ . ' -D macro2'
@@ -509,7 +509,7 @@ Execute(We should include several important flags):
\ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++'
\ . ' -iplugindir=dir -march=native -w',
\ ale#c#ParseCFlags(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 0,
\ [
\ 'gcc',
@@ -569,14 +569,14 @@ Execute(We should include several important flags):
Execute(We should quote the flags we need to quote):
AssertEqual
- \ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/inc'))
- \ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include'))
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incquote'))
- \ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incsystem'))
- \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
- \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
- \ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
- \ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
+ \ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/inc'))
+ \ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/include'))
+ \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incquote'))
+ \ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incsystem'))
+ \ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test-files/c/makefile_project/incafter'))
+ \ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incframework'))
+ \ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/foo bar'))
+ \ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test-files/c/makefile_project/incmacros'))
\ . ' ' . ale#Escape('-Dmacro="value"')
\ . ' -DGoal=9'
\ . ' -D macro2'
@@ -592,7 +592,7 @@ Execute(We should quote the flags we need to quote):
\ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++'
\ . ' -iplugindir=dir -march=native -w',
\ ale#c#ParseCFlags(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 1,
\ [
\ 'gcc',
@@ -656,7 +656,7 @@ Execute(We should exclude other flags that cause problems):
AssertEqual
\ '',
\ ale#c#ParseCFlags(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 0,
\ [
\ 'gcc',
@@ -678,7 +678,7 @@ Execute(We should expand @file in CFlags):
AssertEqual
\ '-DARGS1 -DARGS2 -O2',
\ ale#c#ParseCFlags(
- \ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ ale#path#Simplify(g:dir. '/test-files/c/makefile_project'),
\ 0,
\ [
\ 'gcc',