More tests for the Waf preprocessor

This commit is contained in:
Thomas Nagy 2014-11-02 00:16:48 +01:00
parent 67a5bb5c73
commit e048bed13d
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
9 changed files with 41 additions and 6 deletions

View File

@ -1,4 +1,4 @@
NEW IN WAF 1.8.3
NEW IN WAF 1.8.4
----------------
* Various improvements in stale.py
* More robust file scanning in Qt processing #1502

View File

@ -0,0 +1,6 @@
#include "a.h"
int main() {
return 0;
}

View File

@ -0,0 +1,8 @@
#ifdef FOO
#include "c.h"
#endif
#ifdef BAR
#include "b.h"
#endif

View File

@ -0,0 +1 @@
#include "c.h"

View File

@ -0,0 +1,3 @@
#undef FOO
#undef BAR
#include "a.h"

View File

@ -171,6 +171,23 @@ def build(bld):
test('a&&b&&c&&d', 0)
test('e', 1)
def test_rec(defines, expected):
main = bld.path.find_resource('recursion/a.c')
bld.env.DEFINES = defines.split()
gruik = c_preproc.c_parser([main.parent])
gruik.start(main, bld.env)
result = "".join([x.name[0] for x in gruik.nodes])
if result == expected:
color = "GREEN"
else:
color = "RED"
pprint(color, "%s\t\t%r" % (expected, gruik.nodes))
test_rec("", "a")
test_rec("FOO=1", "aca")
test_rec("BAR=1", "abca")
test_rec("FOO=1 BAR=1", "aca")
return
test("1?1,(0?5:9):3,4", 0) # <- invalid expression

View File

@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
import os, sys, inspect
VERSION="1.8.3"
VERSION="1.8.4"
REVISION="x"
INSTALL="x"
C1='x'

View File

@ -11,13 +11,13 @@ from waflib import Utils, Errors, Logs
import waflib.Node
# the following 3 constants are updated on each new release (do not touch)
HEXVERSION=0x1080300
HEXVERSION=0x1080400
"""Constant updated on new releases"""
WAFVERSION="1.8.3"
WAFVERSION="1.8.4"
"""Constant updated on new releases"""
WAFREVISION="2fa4078c47451df99ba831a98ab6c28a7ee36ae2"
WAFREVISION="67a5bb5c730ba3abebccdbe64a4f509d92f33b9e"
"""Constant updated on new releases"""
ABI = 98

View File

@ -10,7 +10,7 @@ To add a tool that does not exist in the folder compat15, pass an absolute path:
"""
VERSION="1.8.3"
VERSION="1.8.4"
APPNAME='waf'
REVISION=''