contract

Modules

aggregates
module contract.aggregates
Undocumented in source.
array
module contract.array
Undocumented in source.
constexpr
module contract.constexpr
Undocumented in source.
functions
module contract.functions
Undocumented in source.
inheritance
module contract.inheritance
Undocumented in source.
issues
module contract.issues
Undocumented in source.
macro_
module contract.macro_
Undocumented in source.
member
module contract.member

Member pointers

methods
module contract.methods
Undocumented in source.
namespace
module contract.namespace
Undocumented in source.
operators
module contract.operators
Undocumented in source.
templates
module contract.templates
Undocumented in source.
typedef_
module contract.typedef_
Undocumented in source.

Public Imports

unit_threaded
public import unit_threaded;
clang
public import clang : Cursor, Type;

Members

Enums

TestMode
enum TestMode
Undocumented in source.

Functions

cCode
C cCode()
Undocumented in source. Be warned that the author may not have intended to support it.
child
const(Cursor) child(Cursor cursor, int index)
Undocumented in source. Be warned that the author may not have intended to support it.
createMockTranslationUnit
auto createMockTranslationUnit()
Undocumented in source. Be warned that the author may not have intended to support it.
createRealTranslationUnit
auto createRealTranslationUnit()
Undocumented in source. Be warned that the author may not have intended to support it.
createTranslationUnit
auto createTranslationUnit()

Creates a real or mock translation unit depending on the type

expect
auto expect(L lhs, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
expectEqual
auto expectEqual(L lhs, K kind, string spelling, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
expectLength
auto expectLength(L lhs, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
mockTU
auto mockTU()

Searches moduleName for a contract function that creates a mock translation unit cursor, calls it, and returns the value

mockTuMixin
string mockTuMixin(string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
parse
auto parse()

Parses C/C++ code located in a UDA on codeURL

parse
auto parse()

Parses C/C++ code located in a UDA on testName which is in module moduleName

parse
auto parse(T code, from!"clang".TranslationUnitFlags tuFlags)
Undocumented in source. Be warned that the author may not have intended to support it.
printChildren
void printChildren(T cursorOrTU)
Undocumented in source. Be warned that the author may not have intended to support it.
shouldMatch
void shouldMatch(T obj, K kind, string spelling, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixin templates

Contract
mixintemplate Contract(TestName testName, alias contractFunction, size_t line = __LINE__)

Defines a contract test by mixing in a new test function.

createTU
mixintemplate createTU(T, string moduleName, string testName)

Create a variable called tu that is either a MockCursor or a real clang one depending on the type T

Structs

C
struct C
Undocumented in source.
CodeURL
struct CodeURL

A way to identify a snippet of C/C++ code for testing.

ContractFunction
struct ContractFunction

To be used as a UDA indicating a function that does double duty as: * a contract test * builds a mock to satisfy the same contract

Cpp
struct Cpp
Undocumented in source.
MockCursor
struct MockCursor

Walks like a clang.Cursor, quacks like a clang.Cursor

MockTU
struct MockTU(alias F)

To be used as a UDA on contract tests establishing how to create a mock translation unit cursor that behaves _exactly_ the same as the one obtained by libclang. This is enforced at contract test time.

MockType
struct MockType

Walks like a clang.Type, quacks like a clang.Type

Module
struct Module
Undocumented in source.
TestName
struct TestName
Undocumented in source.

Templates

InferTestMode
template InferTestMode(alias lhs)

Calculate if we're in mocking or verifying mode using reflection

Meta