1
This is an automatic consistency check for NRefactory.
2
It loads a solution file and parses all the source code and referenced libraries,
3
and then performs a set of consistency checks.
4
These checks assume that the code is valid C# without any compilation errors,
5
so make sure to only pass in compilable source code.
7
Checks currently being performed:
8
- IDStringConsistencyCheck: Checks that ID strings are unique and refer back to the correct entity
9
- RoundtripTest: parses C# code and outputs it again using CSharpOutputVisitor, checking that only whitespace is changing
10
- ResolverTest: fully resolves all ASTs and validates that no errors are detected (no false positives in semantic error checking)
11
- RandomizedOrderResolverTest: checks that the order of Resolve()/GetResolverState() calls has no effect on the result
12
- FindReferencesConsistencyCheck: checks that FindReferences is the inverse of FindReferencedEntities
15
- IncrementalXmlParserTests: tests that incremental parsing produces results identical to a full reparse
16
- XmlReaderTests: compares AXmlParser.Parse().CreateReader() with new XmlTextReader()
20
Ideas for further tests:
21
- Test token positions (see AstVerifier)
22
- Compare resolve results with csc compiler output (using Cecil)
23
- Randomly mutate a C# file (e.g. remove tokens) and verify that the parser does not crash