summaryrefslogtreecommitdiffstats
path: root/test cases/rewrite
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/rewrite
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/rewrite')
-rw-r--r--test cases/rewrite/1 basic/addSrc.json94
-rw-r--r--test cases/rewrite/1 basic/addTgt.json9
-rw-r--r--test cases/rewrite/1 basic/info.json57
-rw-r--r--test cases/rewrite/1 basic/meson.build19
-rw-r--r--test cases/rewrite/1 basic/rmSrc.json88
-rw-r--r--test cases/rewrite/1 basic/rmTgt.json17
-rw-r--r--test cases/rewrite/2 subdirs/addSrc.json13
-rw-r--r--test cases/rewrite/2 subdirs/addTgt.json10
-rw-r--r--test cases/rewrite/2 subdirs/info.json12
-rw-r--r--test cases/rewrite/2 subdirs/meson.build4
-rw-r--r--test cases/rewrite/2 subdirs/rmTgt.json7
-rw-r--r--test cases/rewrite/2 subdirs/sub1/meson.build1
-rw-r--r--test cases/rewrite/2 subdirs/sub2/meson.build1
-rw-r--r--test cases/rewrite/3 kwargs/add.json38
-rw-r--r--test cases/rewrite/3 kwargs/defopts_delete.json18
-rw-r--r--test cases/rewrite/3 kwargs/defopts_set.json24
-rw-r--r--test cases/rewrite/3 kwargs/delete.json20
-rw-r--r--test cases/rewrite/3 kwargs/info.json20
-rw-r--r--test cases/rewrite/3 kwargs/meson.build7
-rw-r--r--test cases/rewrite/3 kwargs/remove.json38
-rw-r--r--test cases/rewrite/3 kwargs/remove_regex.json29
-rw-r--r--test cases/rewrite/3 kwargs/set.json34
-rw-r--r--test cases/rewrite/4 same name targets/addSrc.json8
-rw-r--r--test cases/rewrite/4 same name targets/info.json12
-rw-r--r--test cases/rewrite/4 same name targets/meson.build6
-rw-r--r--test cases/rewrite/4 same name targets/sub1/meson.build3
-rw-r--r--test cases/rewrite/5 sorting/meson.build33
-rw-r--r--test cases/rewrite/6 extra_files/addExtraFiles.json111
-rw-r--r--test cases/rewrite/6 extra_files/info.json57
-rw-r--r--test cases/rewrite/6 extra_files/meson.build21
-rw-r--r--test cases/rewrite/6 extra_files/rmExtraFiles.json93
31 files changed, 904 insertions, 0 deletions
diff --git a/test cases/rewrite/1 basic/addSrc.json b/test cases/rewrite/1 basic/addSrc.json
new file mode 100644
index 0000000..b8bc439
--- /dev/null
+++ b/test cases/rewrite/1 basic/addSrc.json
@@ -0,0 +1,94 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "src_add",
+ "sources": ["a2.cpp", "a1.cpp", "a2.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog2",
+ "operation": "src_add",
+ "sources": ["a7.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "src_add",
+ "sources": ["a5.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "src_add",
+ "sources": ["a5.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "src_add",
+ "sources": ["a3.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "src_add",
+ "sources": ["a4.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "src_add",
+ "sources": ["a6.cpp", "a1.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog0",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog2",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog8",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/1 basic/addTgt.json b/test cases/rewrite/1 basic/addTgt.json
new file mode 100644
index 0000000..2f4e7e2
--- /dev/null
+++ b/test cases/rewrite/1 basic/addTgt.json
@@ -0,0 +1,9 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog10",
+ "operation": "target_add",
+ "sources": ["new1.cpp", "new2.cpp"],
+ "target_type": "shared_library"
+ }
+]
diff --git a/test cases/rewrite/1 basic/info.json b/test cases/rewrite/1 basic/info.json
new file mode 100644
index 0000000..0f1a3bd
--- /dev/null
+++ b/test cases/rewrite/1 basic/info.json
@@ -0,0 +1,57 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog0",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe2",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe4",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe6",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe8",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog10",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/1 basic/meson.build b/test cases/rewrite/1 basic/meson.build
new file mode 100644
index 0000000..0f87c45
--- /dev/null
+++ b/test cases/rewrite/1 basic/meson.build
@@ -0,0 +1,19 @@
+project('rewritetest', 'cpp')
+
+src1 = ['main.cpp', 'fileA.cpp']
+src2 = files(['fileB.cpp', 'fileC.cpp'])
+src3 = src1
+src4 = [src3]
+
+# Magic comment
+
+exe0 = executable('trivialprog0', src1 + src2)
+exe1 = executable('trivialprog1', src1)
+exe2 = executable('trivialprog2', [src2])
+exe3 = executable('trivialprog3', ['main.cpp', 'fileA.cpp'])
+exe4 = executable('trivialprog4', ['main.cpp', ['fileA.cpp']])
+exe5 = executable('trivialprog5', [src2, 'main.cpp'])
+exe6 = executable('trivialprog6', 'main.cpp', 'fileA.cpp')
+exe7 = executable('trivialprog7', 'fileB.cpp', src1, 'fileC.cpp')
+exe8 = executable('trivialprog8', src3)
+executable('trivialprog9', src4)
diff --git a/test cases/rewrite/1 basic/rmSrc.json b/test cases/rewrite/1 basic/rmSrc.json
new file mode 100644
index 0000000..2e7447c
--- /dev/null
+++ b/test cases/rewrite/1 basic/rmSrc.json
@@ -0,0 +1,88 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "src_rm",
+ "sources": ["fileA.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "src_rm",
+ "sources": ["fileA.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "src_rm",
+ "sources": ["fileA.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "src_rm",
+ "sources": ["fileB.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "src_rm",
+ "sources": ["fileA.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "src_rm",
+ "sources": ["fileB.cpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog0",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog2",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog8",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/1 basic/rmTgt.json b/test cases/rewrite/1 basic/rmTgt.json
new file mode 100644
index 0000000..dbaf025
--- /dev/null
+++ b/test cases/rewrite/1 basic/rmTgt.json
@@ -0,0 +1,17 @@
+[
+ {
+ "type": "target",
+ "target": "exe0",
+ "operation": "target_rm"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "target_rm"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "target_rm"
+ }
+]
diff --git a/test cases/rewrite/2 subdirs/addSrc.json b/test cases/rewrite/2 subdirs/addSrc.json
new file mode 100644
index 0000000..1a5c13e
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/addSrc.json
@@ -0,0 +1,13 @@
+[
+ {
+ "type": "target",
+ "target": "something",
+ "operation": "src_add",
+ "sources": ["third.c"]
+ },
+ {
+ "type": "target",
+ "target": "something",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/2 subdirs/addTgt.json b/test cases/rewrite/2 subdirs/addTgt.json
new file mode 100644
index 0000000..2e1e8bc
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/addTgt.json
@@ -0,0 +1,10 @@
+[
+ {
+ "type": "target",
+ "target": "newLib",
+ "operation": "target_add",
+ "sources": ["new1.cpp", "new2.cpp"],
+ "target_type": "shared_library",
+ "subdir": "sub2"
+ }
+]
diff --git a/test cases/rewrite/2 subdirs/info.json b/test cases/rewrite/2 subdirs/info.json
new file mode 100644
index 0000000..dba2cd6
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/info.json
@@ -0,0 +1,12 @@
+[
+ {
+ "type": "target",
+ "target": "something",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "newLib",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/2 subdirs/meson.build b/test cases/rewrite/2 subdirs/meson.build
new file mode 100644
index 0000000..c7f3fec
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/meson.build
@@ -0,0 +1,4 @@
+project('subdir rewrite', 'c')
+
+subdir('sub1')
+subdir('sub2')
diff --git a/test cases/rewrite/2 subdirs/rmTgt.json b/test cases/rewrite/2 subdirs/rmTgt.json
new file mode 100644
index 0000000..9b112f9
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/rmTgt.json
@@ -0,0 +1,7 @@
+[
+ {
+ "type": "target",
+ "target": "something",
+ "operation": "target_rm"
+ }
+]
diff --git a/test cases/rewrite/2 subdirs/sub1/meson.build b/test cases/rewrite/2 subdirs/sub1/meson.build
new file mode 100644
index 0000000..ca42205
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/sub1/meson.build
@@ -0,0 +1 @@
+srcs = ['first.c', 'second.c']
diff --git a/test cases/rewrite/2 subdirs/sub2/meson.build b/test cases/rewrite/2 subdirs/sub2/meson.build
new file mode 100644
index 0000000..44b4075
--- /dev/null
+++ b/test cases/rewrite/2 subdirs/sub2/meson.build
@@ -0,0 +1 @@
+executable('something', srcs)
diff --git a/test cases/rewrite/3 kwargs/add.json b/test cases/rewrite/3 kwargs/add.json
new file mode 100644
index 0000000..5b3ce0b
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/add.json
@@ -0,0 +1,38 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "set",
+ "kwargs": {
+ "license": "GPL"
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "add",
+ "kwargs": {
+ "license": ["MIT"]
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "add",
+ "kwargs": {
+ "license": "BSD"
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "//",
+ "operation": "add",
+ "kwargs": {
+ "license": "Boost"
+ }
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/defopts_delete.json b/test cases/rewrite/3 kwargs/defopts_delete.json
new file mode 100644
index 0000000..4fe39e2
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/defopts_delete.json
@@ -0,0 +1,18 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "set",
+ "kwargs": {
+ "default_options": ["cpp_std=c++14", "buildtype=release", "debug=true"]
+ }
+ },
+ {
+ "type": "default_options",
+ "operation": "delete",
+ "options": {
+ "buildtype": null
+ }
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/defopts_set.json b/test cases/rewrite/3 kwargs/defopts_set.json
new file mode 100644
index 0000000..f8f855f
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/defopts_set.json
@@ -0,0 +1,24 @@
+[
+ {
+ "type": "default_options",
+ "operation": "set",
+ "options": {
+ "cpp_std": "c++14"
+ }
+ },
+ {
+ "type": "default_options",
+ "operation": "set",
+ "options": {
+ "buildtype": "release",
+ "debug": true
+ }
+ },
+ {
+ "type": "default_options",
+ "operation": "set",
+ "options": {
+ "cpp_std": "c++11"
+ }
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/delete.json b/test cases/rewrite/3 kwargs/delete.json
new file mode 100644
index 0000000..7047f4a
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/delete.json
@@ -0,0 +1,20 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "delete",
+ "kwargs": {
+ "version": null
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "target",
+ "id": "helloWorld",
+ "operation": "delete",
+ "kwargs": {
+ "build_by_default": false
+ }
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/info.json b/test cases/rewrite/3 kwargs/info.json
new file mode 100644
index 0000000..0eed404
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/info.json
@@ -0,0 +1,20 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "info"
+ },
+ {
+ "type": "kwargs",
+ "function": "target",
+ "id": "tgt1",
+ "operation": "info"
+ },
+ {
+ "type": "kwargs",
+ "function": "dependency",
+ "id": "dep1",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/meson.build b/test cases/rewrite/3 kwargs/meson.build
new file mode 100644
index 0000000..13b336c
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/meson.build
@@ -0,0 +1,7 @@
+project('rewritetest', 'cpp', version: '0.0.1')
+
+# Find ZLIB
+dep1 = dependency('zlib', required: false)
+
+# Make a test exe
+tgt1 = executable('helloWorld', 'main.cpp', build_by_default: true)
diff --git a/test cases/rewrite/3 kwargs/remove.json b/test cases/rewrite/3 kwargs/remove.json
new file mode 100644
index 0000000..e33cb66
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/remove.json
@@ -0,0 +1,38 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "set",
+ "kwargs": {
+ "license": ["GPL", "MIT", "BSD", "Boost"]
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "remove",
+ "kwargs": {
+ "license": ["MIT"]
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "remove",
+ "kwargs": {
+ "license": "BSD"
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "//",
+ "operation": "remove",
+ "kwargs": {
+ "license": "Boost"
+ }
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/remove_regex.json b/test cases/rewrite/3 kwargs/remove_regex.json
new file mode 100644
index 0000000..07fa58e
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/remove_regex.json
@@ -0,0 +1,29 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "set",
+ "kwargs": {
+ "default_options": ["cpp_std=c++14", "buildtype=release", "debug=true"]
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "/",
+ "operation": "remove_regex",
+ "kwargs": {
+ "default_options": ["cpp_std=.*"]
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "//",
+ "operation": "remove_regex",
+ "kwargs": {
+ "default_options": ["buildtype=.*"]
+ }
+ }
+]
diff --git a/test cases/rewrite/3 kwargs/set.json b/test cases/rewrite/3 kwargs/set.json
new file mode 100644
index 0000000..6ca2ee4
--- /dev/null
+++ b/test cases/rewrite/3 kwargs/set.json
@@ -0,0 +1,34 @@
+[
+ {
+ "type": "kwargs",
+ "function": "project",
+ "id": "//",
+ "operation": "set",
+ "kwargs": {
+ "version": "0.0.2",
+ "meson_version": "0.50.0",
+ "license": ["GPL", "MIT"]
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "target",
+ "id": "helloWorld",
+ "operation": "set",
+ "kwargs": {
+ "build_by_default": false,
+ "build_rpath": "/usr/local",
+ "dependencies": "dep1"
+ }
+ },
+ {
+ "type": "kwargs",
+ "function": "dependency",
+ "id": "zlib",
+ "operation": "set",
+ "kwargs": {
+ "required": true,
+ "method": "cmake"
+ }
+ }
+]
diff --git a/test cases/rewrite/4 same name targets/addSrc.json b/test cases/rewrite/4 same name targets/addSrc.json
new file mode 100644
index 0000000..98d0d1e
--- /dev/null
+++ b/test cases/rewrite/4 same name targets/addSrc.json
@@ -0,0 +1,8 @@
+[
+ {
+ "type": "target",
+ "target": "myExe",
+ "operation": "src_add",
+ "sources": ["a1.cpp", "a2.cpp"]
+ }
+]
diff --git a/test cases/rewrite/4 same name targets/info.json b/test cases/rewrite/4 same name targets/info.json
new file mode 100644
index 0000000..a9fc2dd
--- /dev/null
+++ b/test cases/rewrite/4 same name targets/info.json
@@ -0,0 +1,12 @@
+[
+ {
+ "type": "target",
+ "target": "exe1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe2",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/4 same name targets/meson.build b/test cases/rewrite/4 same name targets/meson.build
new file mode 100644
index 0000000..384fa2b
--- /dev/null
+++ b/test cases/rewrite/4 same name targets/meson.build
@@ -0,0 +1,6 @@
+project('rewrite same name targets', 'cpp')
+
+src1 = ['main.cpp']
+
+exe1 = executable('myExe', src1)
+subdir('sub1')
diff --git a/test cases/rewrite/4 same name targets/sub1/meson.build b/test cases/rewrite/4 same name targets/sub1/meson.build
new file mode 100644
index 0000000..ac53667
--- /dev/null
+++ b/test cases/rewrite/4 same name targets/sub1/meson.build
@@ -0,0 +1,3 @@
+src2 = ['main.cpp']
+
+exe2 = executable('myExe', src2)
diff --git a/test cases/rewrite/5 sorting/meson.build b/test cases/rewrite/5 sorting/meson.build
new file mode 100644
index 0000000..80934a0
--- /dev/null
+++ b/test cases/rewrite/5 sorting/meson.build
@@ -0,0 +1,33 @@
+project('rewriter source sorting', ['c', 'cpp'])
+
+src1 = files([
+ 'a1.c',
+ 'a10.c',
+ 'a2.c',
+ 'a3.c',
+ 'bbb/a/b1.c',
+ 'bbb/a4.c',
+ 'bbb/b3.c',
+ 'bbb/b4.c',
+ 'bbb/b/b2.c',
+ 'bbb/c1/b5.c',
+ 'bbb/c10/b6.c',
+ 'bbb/c2/b7.c',
+ 'bbb/b5.c',
+ 'a110.c',
+ 'aaa/f1.c',
+ 'aaa/f2.c',
+ 'aaa/f3.c',
+ 'a20.c',
+ 'b1.c',
+ 'aaa/b/b1.c',
+ 'aaa/b/b2.c',
+ 'a30.c',
+ 'a100.c',
+ 'aaa/a/a1.c',
+ 'a101.c',
+ 'a210.c',
+ 'c2.c'
+])
+
+exe1 = executable('exe1', src1)
diff --git a/test cases/rewrite/6 extra_files/addExtraFiles.json b/test cases/rewrite/6 extra_files/addExtraFiles.json
new file mode 100644
index 0000000..421ed92
--- /dev/null
+++ b/test cases/rewrite/6 extra_files/addExtraFiles.json
@@ -0,0 +1,111 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "extra_files_add",
+ "sources": ["a2.hpp", "a1.hpp", "a2.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog2",
+ "operation": "extra_files_add",
+ "sources": ["a7.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "extra_files_add",
+ "sources": ["a5.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "extra_files_add",
+ "sources": ["a5.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "extra_files_add",
+ "sources": ["a3.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "extra_files_add",
+ "sources": ["a6.hpp", "a1.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog8",
+ "operation": "extra_files_add",
+ "sources": ["a2.hpp", "a7.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "extra_files_add",
+ "sources": ["a9.hpp", "a8.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog10",
+ "operation": "extra_files_add",
+ "sources": ["a4.hpp", "a1.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog0",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog2",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog8",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog10",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/6 extra_files/info.json b/test cases/rewrite/6 extra_files/info.json
new file mode 100644
index 0000000..0f1a3bd
--- /dev/null
+++ b/test cases/rewrite/6 extra_files/info.json
@@ -0,0 +1,57 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog0",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe2",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe4",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe6",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "exe8",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog10",
+ "operation": "info"
+ }
+]
diff --git a/test cases/rewrite/6 extra_files/meson.build b/test cases/rewrite/6 extra_files/meson.build
new file mode 100644
index 0000000..f9aab46
--- /dev/null
+++ b/test cases/rewrite/6 extra_files/meson.build
@@ -0,0 +1,21 @@
+project('rewritetest', 'cpp')
+
+ef1 = ['main.hpp', 'fileA.hpp']
+ef2 = files(['fileB.hpp', 'fileC.hpp'])
+ef3 = ef1
+ef4 = [ef3]
+ef5 = []
+
+# Magic comment
+
+exe0 = executable('trivialprog0', 'main.cpp', extra_files : ef1 + ef2)
+exe1 = executable('trivialprog1', 'main.cpp', extra_files : ef1)
+exe2 = executable('trivialprog2', 'main.cpp', extra_files : [ef2])
+exe3 = executable('trivialprog3', 'main.cpp', extra_files : ['main.hpp', 'fileA.hpp'])
+exe4 = executable('trivialprog4', 'main.cpp', extra_files : ['main.hpp', ['fileA.hpp']])
+exe5 = executable('trivialprog5', 'main.cpp', extra_files : [ef2, 'main.hpp'])
+exe6 = executable('trivialprog6', 'main.cpp', extra_files : ef3)
+executable('trivialprog7', 'main.cpp', extra_files : ef4)
+exe8 = executable('trivialprog8', 'main.cpp', extra_files : [])
+exe9 = executable('trivialprog9', 'main.cpp')
+exe10 = executable('trivialprog10', 'main.cpp', extra_files : ef5)
diff --git a/test cases/rewrite/6 extra_files/rmExtraFiles.json b/test cases/rewrite/6 extra_files/rmExtraFiles.json
new file mode 100644
index 0000000..bd2855b
--- /dev/null
+++ b/test cases/rewrite/6 extra_files/rmExtraFiles.json
@@ -0,0 +1,93 @@
+[
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "extra_files_rm",
+ "sources": ["fileA.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "extra_files_rm",
+ "sources": ["fileA.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "extra_files_rm",
+ "sources": ["fileA.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "extra_files_rm",
+ "sources": ["fileB.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "extra_files_rm",
+ "sources": ["fileA.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "extra_files_rm",
+ "sources": ["fileA.hpp"]
+ },
+ {
+ "type": "target",
+ "target": "trivialprog0",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog1",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog2",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog3",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog4",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog5",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog6",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog7",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog8",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog9",
+ "operation": "info"
+ },
+ {
+ "type": "target",
+ "target": "trivialprog10",
+ "operation": "info"
+ }
+]