summaryrefslogtreecommitdiffstats
path: root/tools/slang-test/filecheck.h
blob: 1a26606b1ef97f2bdb1c573ecb342a6768fc4b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "../../source/compiler-core/slang-artifact.h"
#include "../../source/core/slang-common.h"
#include "../../tools/unit-test/slang-unit-test.h"

namespace Slang
{

class IFileCheck : public ICastable
{
public:
    SLANG_COM_INTERFACE(
        0x046bfe4a,
        0x99a3,
        0x402f,
        {0x83, 0xd7, 0x81, 0x8d, 0xa1, 0x38, 0xed, 0xfa})

    using ReportDiagnostic = void(SLANG_STDCALL*)(void*, TestMessageType, const char*) noexcept;

    virtual TestResult SLANG_MCALL performTest(
        const char* programName,       // Included in diagnostic messages, for example "slang-test"
        const char* rulesFilePath,     // The file from which to read the FileCheck rules
        const char* fileCheckPrefix,   // The name of the FileCheck files to use in the rules file
        const char* stringToCheck,     // The string to match with the rules
        const char* stringToCheckName, // The name of that string, for example "actual-output"
        ReportDiagnostic testReporter, // A callback for reporting diagnostic messages
        void* reporterData,            // Some data to pass on to the callback
        bool colorDiagnosticOutput     // Include color control codes in the string passed to
                                       // testReporter
        ) noexcept = 0;
};

} // namespace Slang