|
| 1 | + |
| 2 | +These tests are not intuitive at all. So we need some documentation here. |
| 3 | + |
| 4 | +These tests compare outcomes from generator to the "expected" outcomes. |
| 5 | + |
| 6 | +It does not work together with class-parse, so you cannot pass any jars |
| 7 | +nor java sources, which is a pain point (but those who created these tests |
| 8 | +didn't care). |
| 9 | + |
| 10 | +There are two "expected" set of files. One is "expected" and the other is |
| 11 | +"expected.ji". They are different per Java.Interop output methods. |
| 12 | + |
| 13 | +The differences between "expected" and "expected.ji" are almost only |
| 14 | +annoying, but this test blindly compares those differences. So if you are |
| 15 | +going to add tests you will have to duplicate your work twice... |
| 16 | + |
| 17 | +Tests that use `BaseGeneratorTest` are organized as: |
| 18 | + |
| 19 | +./BaseGeneratorTest.cs - sets up generation and compilation options. |
| 20 | +./Compiler.cs - implements C# compilation with `CodeDomProvider`. |
| 21 | +./(others).cs - the actual `TestFixture`s. |
| 22 | + |
| 23 | +What those tests do are: |
| 24 | + |
| 25 | +- invoke class-parse (and perhaps jar2xml), to generate XML API inputs to generator. |
| 26 | +- invoke generator, to generate comparable sources. |
| 27 | +- optionally invoke csc to see if it builds. |
| 28 | + |
| 29 | +`BaseGeneratorTest` takes the arguments below, |
| 30 | + |
| 31 | +- outputRelativePath - path to generator output subdir |
| 32 | +- apiDescriptionFile - path to the input API XML output. Sadly existing tests |
| 33 | + are organized horribly and they reside in the "expected" directory. |
| 34 | +- expectedRelativePath - path to the "expected" file generation. |
| 35 | +- additionalSupportPaths - path to additional compilation items. |
| 36 | + |
| 37 | +The test outputs are generated to `out` and `out.ji` directories, per |
| 38 | +the generator's output method. |
| 39 | + |
| 40 | +When you are creating a new test, it is easier to once generate results in |
| 41 | +those `out` and `out.ji` directories, and copy them as "expected" and |
| 42 | +"expected.ji" with required changes (so that they become really expected |
| 43 | +contents). |
0 commit comments