The source code to test.
An array of string array. Each slot represents the variable name followed by the type strings.
Parses source, caches its symbols and compares the the cache content with the results.
Params: source = The source code to test. results = An array of string array. Each slot represents the variable name followed by the type strings.
writeln("Running type deduction tests..."); q{bool b; int i;}.expectSymbolsAndTypes([["b", "bool"],["i", "int"]]); q{auto b = false;}.expectSymbolsAndTypes([["b", "bool"]]); q{auto b = true;}.expectSymbolsAndTypes([["b", "bool"]]); q{auto b = [0];}.expectSymbolsAndTypes([["b", "*arr*", "int"]]); q{auto b = [[0]];}.expectSymbolsAndTypes([["b", "*arr*", "*arr*", "int"]]); q{auto b = [[[0]]];}.expectSymbolsAndTypes([["b", "*arr*", "*arr*", "*arr*", "int"]]); //q{int* b;}.expectSymbolsAndTypes([["b", "*", "int"]]); //q{int*[] b;}.expectSymbolsAndTypes([["b", "*arr*", "*", "int"]]);
Parses source, caches its symbols and compares the the cache content with the results.
Params: source = The source code to test. results = An array of string array. Each slot represents the variable name followed by the type strings.
ModuleCache cache = ModuleCache(theAllocator); writeln("Running non-importable symbols tests..."); auto source = q{ class A { this(int a){} } class B : A {} class C { A f; alias f this; } }; auto pair = generateAutocompleteTrees(source, cache); auto A = pair.symbol.getFirstPartNamed(internString("A")); auto B = pair.symbol.getFirstPartNamed(internString("B")); auto C = pair.symbol.getFirstPartNamed(internString("C")); assert(A.getFirstPartNamed(CONSTRUCTOR_SYMBOL_NAME) !is null); assert(B.getFirstPartNamed(CONSTRUCTOR_SYMBOL_NAME) is null); assert(C.getFirstPartNamed(CONSTRUCTOR_SYMBOL_NAME) is null);
Parses source, caches its symbols and compares the the cache content with the results.