Zebediah Figura : tests: Add a test for macro invocation split across multiple files.

Alexandre Julliard julliard at winehq.org
Wed Dec 2 15:20:59 CST 2020


Module: vkd3d
Branch: master
Commit: f4bbbb2975d056d4eb587b6e8293e8bc35ca7c26
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=f4bbbb2975d056d4eb587b6e8293e8bc35ca7c26

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Dec  1 20:51:11 2020 -0600

tests: Add a test for macro invocation split across multiple files.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tests/hlsl_d3d12.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c
index 03a732c..4f4cc37 100644
--- a/tests/hlsl_d3d12.c
+++ b/tests/hlsl_d3d12.c
@@ -72,6 +72,14 @@ static const char test_include_file2[] =
 static const char test_include_file3[] =
     "#undef BRONTES";
 
+static const char test_include2_top[] =
+    "#define FUNC(a, b) a ## b\n"
+    "#include \"file4\"\n"
+    ",ss)";
+
+static const char test_include2_file4[] =
+    "FUNC(pa";
+
 static unsigned int refcount_file1, refcount_file2, refcount_file3, include_count_file2;
 
 static HRESULT WINAPI test_include_Open(ID3DInclude *iface, D3D_INCLUDE_TYPE type,
@@ -106,6 +114,13 @@ static HRESULT WINAPI test_include_Open(ID3DInclude *iface, D3D_INCLUDE_TYPE typ
         *size = strlen(test_include_file3);
         ++refcount_file3;
     }
+    else if (!strcmp(filename, "file4"))
+    {
+        ok(type == D3D_INCLUDE_LOCAL, "Got type %#x.\n", type);
+        ok(!parent_data, "Got parent data %p.\n", parent_data);
+        *code = test_include2_file4;
+        *size = strlen(test_include2_file4);
+    }
     else
     {
         ok(0, "Unexpected filename \"%s\".\n", filename);
@@ -390,6 +405,9 @@ static void test_preprocess(void)
     ok(!refcount_file3, "Got %d references to file1.\n", refcount_file3);
     todo ok(include_count_file2 == 2, "file2 was included %u times.\n", include_count_file2);
 
+    /* Macro invocation spread across multiple files. */
+    check_preprocess(test_include2_top, NULL, &test_include, "pass", NULL);
+
     blob = errors = (ID3D10Blob *)0xdeadbeef;
     hr = D3DPreprocess(test_include_top, strlen(test_include_top), NULL, NULL, &test_include_fail, &blob, &errors);
     todo ok(hr == E_FAIL, "Got hr %#x.\n", hr);




More information about the wine-cvs mailing list