From f4bbbb2975d056d4eb587b6e8293e8bc35ca7c26 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 1 Dec 2020 20:51:11 -0600 Subject: [PATCH] tests: Add a test for macro invocation split across multiple files. Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- tests/hlsl_d3d12.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index 03a732ce..4f4cc37f 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);