aboutsummaryrefslogtreecommitdiffstats
path: root/travis/test
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 15:54:39 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 21:43:46 +0300
commit7fd2389637f7eaa5894259f4466e932f66ef50cf (patch)
tree601ffb925b96af385fa41f6ffb26f25bf782abe3 /travis/test
parentfa747e71a878bfa0e1bbb8d31e5f381fa297bf7f (diff)
downloadnasm-7fd2389637f7eaa5894259f4466e932f66ef50cf.tar.gz
nasm-7fd2389637f7eaa5894259f4466e932f66ef50cf.tar.xz
nasm-7fd2389637f7eaa5894259f4466e932f66ef50cf.zip
test: nasm-t -- Add macro-defaults
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'travis/test')
-rw-r--r--travis/test/macro-defaults-nowarn.stderr36
-rw-r--r--travis/test/macro-defaults-warn.stderr39
-rw-r--r--travis/test/macro-defaults.asm64
-rw-r--r--travis/test/macro-defaults.json20
4 files changed, 159 insertions, 0 deletions
diff --git a/travis/test/macro-defaults-nowarn.stderr b/travis/test/macro-defaults-nowarn.stderr
new file mode 100644
index 00000000..34811633
--- /dev/null
+++ b/travis/test/macro-defaults-nowarn.stderr
@@ -0,0 +1,36 @@
+./travis/test/macro-defaults.asm:9: warning: (mmac_fix:3) 2 one a [-w+user]
+./travis/test/macro-defaults.asm:7: ... from macro `mmac_fix' defined here [-w+user]
+./travis/test/macro-defaults.asm:16: warning: (mmac_var:3) 3 one a b [-w+user]
+./travis/test/macro-defaults.asm:14: ... from macro `mmac_var' defined here [-w+user]
+./travis/test/macro-defaults.asm:17: warning: (mmac_var:3) 3 one two b [-w+user]
+./travis/test/macro-defaults.asm:14: ... from macro `mmac_var' defined here [-w+user]
+./travis/test/macro-defaults.asm:27: warning: (mmac_plus:5) 2 one a,b [-w+user]
+./travis/test/macro-defaults.asm:24: ... from macro `mmac_plus' defined here [-w+user]
+./travis/test/macro-defaults.asm:28: warning: (mmac_plus:5) 2 one two [-w+user]
+./travis/test/macro-defaults.asm:24: ... from macro `mmac_plus' defined here [-w+user]
+./travis/test/macro-defaults.asm:29: warning: (mmac_plus:5) 2 one two,three [-w+user]
+./travis/test/macro-defaults.asm:24: ... from macro `mmac_plus' defined here [-w+user]
+./travis/test/macro-defaults.asm:37: warning: (mmac_star:4) 3 one a b [-w+user]
+./travis/test/macro-defaults.asm:35: ... from macro `mmac_star' defined here [-w+user]
+./travis/test/macro-defaults.asm:38: warning: (mmac_star:4) 3 one two b [-w+user]
+./travis/test/macro-defaults.asm:35: ... from macro `mmac_star' defined here [-w+user]
+./travis/test/macro-defaults.asm:39: warning: (mmac_star:4) 3 one two three [-w+user]
+./travis/test/macro-defaults.asm:35: ... from macro `mmac_star' defined here [-w+user]
+./travis/test/macro-defaults.asm:47: warning: (mmac_rotate:1) 2 a b [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:47: warning: (mmac_rotate:4) 2 b a [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:48: warning: (mmac_rotate:1) 2 one b [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:48: warning: (mmac_rotate:4) 2 b one [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:49: warning: (mmac_rotate:1) 2 one two [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:49: warning: (mmac_rotate:4) 2 two one [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:50: warning: (mmac_rotate:1) 3 one two three [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:50: warning: (mmac_rotate:4) 3 two three one [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:64: warning: (mmac_scope:1) 0 0 0 [-w+user]
+./travis/test/macro-defaults.asm:58: ... from macro `mmac_scope' defined here [-w+user] \ No newline at end of file
diff --git a/travis/test/macro-defaults-warn.stderr b/travis/test/macro-defaults-warn.stderr
new file mode 100644
index 00000000..fbc3efa4
--- /dev/null
+++ b/travis/test/macro-defaults-warn.stderr
@@ -0,0 +1,39 @@
+./travis/test/macro-defaults.asm:4: warning: too many default macro parameters [-w+macro-defaults]
+./travis/test/macro-defaults.asm:11: warning: too many default macro parameters [-w+macro-defaults]
+./travis/test/macro-defaults.asm:57: warning: too many default macro parameters [-w+macro-defaults]
+./travis/test/macro-defaults.asm:9: warning: (mmac_fix:3) 2 one a [-w+user]
+./travis/test/macro-defaults.asm:7: ... from macro `mmac_fix' defined here [-w+user]
+./travis/test/macro-defaults.asm:16: warning: (mmac_var:3) 3 one a b [-w+user]
+./travis/test/macro-defaults.asm:14: ... from macro `mmac_var' defined here [-w+user]
+./travis/test/macro-defaults.asm:17: warning: (mmac_var:3) 3 one two b [-w+user]
+./travis/test/macro-defaults.asm:14: ... from macro `mmac_var' defined here [-w+user]
+./travis/test/macro-defaults.asm:27: warning: (mmac_plus:5) 2 one a,b [-w+user]
+./travis/test/macro-defaults.asm:24: ... from macro `mmac_plus' defined here [-w+user]
+./travis/test/macro-defaults.asm:28: warning: (mmac_plus:5) 2 one two [-w+user]
+./travis/test/macro-defaults.asm:24: ... from macro `mmac_plus' defined here [-w+user]
+./travis/test/macro-defaults.asm:29: warning: (mmac_plus:5) 2 one two,three [-w+user]
+./travis/test/macro-defaults.asm:24: ... from macro `mmac_plus' defined here [-w+user]
+./travis/test/macro-defaults.asm:37: warning: (mmac_star:4) 3 one a b [-w+user]
+./travis/test/macro-defaults.asm:35: ... from macro `mmac_star' defined here [-w+user]
+./travis/test/macro-defaults.asm:38: warning: (mmac_star:4) 3 one two b [-w+user]
+./travis/test/macro-defaults.asm:35: ... from macro `mmac_star' defined here [-w+user]
+./travis/test/macro-defaults.asm:39: warning: (mmac_star:4) 3 one two three [-w+user]
+./travis/test/macro-defaults.asm:35: ... from macro `mmac_star' defined here [-w+user]
+./travis/test/macro-defaults.asm:47: warning: (mmac_rotate:1) 2 a b [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:47: warning: (mmac_rotate:4) 2 b a [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:48: warning: (mmac_rotate:1) 2 one b [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:48: warning: (mmac_rotate:4) 2 b one [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:49: warning: (mmac_rotate:1) 2 one two [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:49: warning: (mmac_rotate:4) 2 two one [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:50: warning: (mmac_rotate:1) 3 one two three [-w+user]
+./travis/test/macro-defaults.asm:42: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:50: warning: (mmac_rotate:4) 3 two three one [-w+user]
+./travis/test/macro-defaults.asm:45: ... from macro `mmac_rotate' defined here [-w+user]
+./travis/test/macro-defaults.asm:64: warning: (mmac_scope:1) 0 0 0 [-w+user]
+./travis/test/macro-defaults.asm:58: ... from macro `mmac_scope' defined here [-w+user] \ No newline at end of file
diff --git a/travis/test/macro-defaults.asm b/travis/test/macro-defaults.asm
new file mode 100644
index 00000000..047f2053
--- /dev/null
+++ b/travis/test/macro-defaults.asm
@@ -0,0 +1,64 @@
+;Testname=warning; Arguments=-fbin -omacdef.bin -w+macro-defaults; Files=stdout stderr macdef.bin
+;Testname=nonwarning; Arguments=-fbin -omacdef.bin -w-macro-defaults; Files=stdout stderr macdef.bin
+
+%MACRO mmac_fix 1 a
+ ; While defined to take one parameter, any invocation will
+ ; see two, due to the default parameter.
+ %warning %0 %1 %2 %3 %4 %5
+%ENDMACRO
+mmac_fix one
+
+%MACRO mmac_var 1-2 a,b
+ ; While defined to take one or two parameters, invocations
+ ; will see three, due to the default parameters.
+ %warning %0 %1 %2 %3 %4 %5
+%ENDMACRO
+mmac_var one
+mmac_var one,two
+
+%MACRO mmac_plus 1-2+ a,b
+ ; This does not warn. Although this looks like two default
+ ; parameters, it ends up being only one: the "+" limits it
+ ; to two parameters; if invoked without a second parameter
+ ; the second parameter will be "a,b".
+ %warning %0 %1 %2 %3 %4 %5
+ ;Check rotating behaviour
+%ENDMACRO
+mmac_plus one
+mmac_plus one,two
+mmac_plus one,two,three
+
+%MACRO mmac_star 1-* a,b
+ ; This does not warn. Because the "*" extends the range of
+ ; parameters to infinity, the "a,b" default parameters can
+ ; not exceed that range.
+ %warning %0 %1 %2 %3 %4 %5
+%ENDMACRO
+mmac_star one
+mmac_star one,two
+mmac_star one,two,three
+
+%MACRO mmac_rotate 0-* a,b
+ %warning %0 %1 %2 %3 %4 %5
+ ;%rotate should rotate all parameters
+ %rotate 1
+ %warning %0 %1 %2 %3 %4 %5
+%ENDMACRO
+mmac_rotate
+mmac_rotate one
+mmac_rotate one,two
+mmac_rotate one,two,three
+
+;Scope / evaluation time test
+%define I 0
+%assign J 0
+%xdefine K 0
+
+%MACRO mmac_scope 0 I J K
+ %warning %1 %2 %3
+%ENDMACRO
+
+%define I 1
+%assign J 1
+%xdefine K 1
+mmac_scope
diff --git a/travis/test/macro-defaults.json b/travis/test/macro-defaults.json
new file mode 100644
index 00000000..0de69ac9
--- /dev/null
+++ b/travis/test/macro-defaults.json
@@ -0,0 +1,20 @@
+[
+ {
+ "description": "Test warnings on macro default parameters (warn)",
+ "id": "macro-defaults",
+ "format": "bin",
+ "source": "macro-defaults.asm",
+ "option": "-w+macro-defaults -o macro-defaults.bin",
+ "target": [
+ { "stderr": "macro-defaults-warn.stderr" }
+ ]
+ },
+ {
+ "description": "Test warnings on macro default parameters (nowarn)",
+ "ref": "macro-defaults",
+ "option": "-w-macro-defaults -o macro-defaults.bin",
+ "target": [
+ { "stderr": "macro-defaults-nowarn.stderr" }
+ ]
+ }
+]