c++ - How to unit test deliberate compilation errors? -
Please note that this is not a duplicate because I do not understand about testing the accuracy of external libraries Am or compiler himself This is unique in C ++, especially when the technique is used to deal with templates that prevent certain code from being compiled. As this can be complicated, what is the best way to ensure that pieces of special code actually produce compiler errors? As the test should not be compiled, you can not trust such things as if I think that it should be integrated into the build system? How are these issues usually addressed? Similar compiler tests have been written. You will have some code in the test code in some scripting language (Shell, Pearl, TCL etc.), which will execute the compiler on the given snippet of code and check that the right people have been compiled and not correct.
test :: harness system Should be easier to use. After all, this process is not much work to run from C ++, so try to call the compiler on a string to write the function and check whether the error for the line is output. , Where you expect that it will not be difficult and you can integrate it into other boost.test-based tests. / Li>
Comments
Post a Comment