(self)
| 4885 | shutil.rmtree(temp_dir) |
| 4886 | |
| 4887 | def testJUnitXML(self): |
| 4888 | try: |
| 4889 | cpplint._cpplint_state._junit_errors = [] |
| 4890 | cpplint._cpplint_state._junit_failures = [] |
| 4891 | expected = ( |
| 4892 | '<?xml version="1.0" encoding="UTF-8" ?>\n' |
| 4893 | '<testsuite errors="0" failures="0" name="cpplint" tests="1">' |
| 4894 | '<testcase name="passed" />' |
| 4895 | "</testsuite>" |
| 4896 | ) |
| 4897 | assert expected == cpplint._cpplint_state.FormatJUnitXML() |
| 4898 | |
| 4899 | cpplint._cpplint_state._junit_errors = ["ErrMsg1"] |
| 4900 | cpplint._cpplint_state._junit_failures = [] |
| 4901 | expected = ( |
| 4902 | '<?xml version="1.0" encoding="UTF-8" ?>\n' |
| 4903 | '<testsuite errors="1" failures="0" name="cpplint" tests="1">' |
| 4904 | '<testcase name="errors"><error>ErrMsg1</error></testcase>' |
| 4905 | "</testsuite>" |
| 4906 | ) |
| 4907 | assert expected == cpplint._cpplint_state.FormatJUnitXML() |
| 4908 | |
| 4909 | cpplint._cpplint_state._junit_errors = ["ErrMsg1", "ErrMsg2"] |
| 4910 | cpplint._cpplint_state._junit_failures = [] |
| 4911 | expected = ( |
| 4912 | '<?xml version="1.0" encoding="UTF-8" ?>\n' |
| 4913 | '<testsuite errors="2" failures="0" name="cpplint" tests="2">' |
| 4914 | '<testcase name="errors"><error>ErrMsg1\nErrMsg2</error></testcase>' |
| 4915 | "</testsuite>" |
| 4916 | ) |
| 4917 | assert expected == cpplint._cpplint_state.FormatJUnitXML() |
| 4918 | |
| 4919 | cpplint._cpplint_state._junit_errors = ["ErrMsg"] |
| 4920 | cpplint._cpplint_state._junit_failures = [ |
| 4921 | ("File", 5, "FailMsg", "category/subcategory", 3) |
| 4922 | ] |
| 4923 | expected = ( |
| 4924 | '<?xml version="1.0" encoding="UTF-8" ?>\n' |
| 4925 | '<testsuite errors="1" failures="1" name="cpplint" tests="2">' |
| 4926 | '<testcase name="errors"><error>ErrMsg</error></testcase>' |
| 4927 | '<testcase name="File"><failure>5: FailMsg [category/subcategory] ' |
| 4928 | "[3]</failure></testcase></testsuite>" |
| 4929 | ) |
| 4930 | assert expected == cpplint._cpplint_state.FormatJUnitXML() |
| 4931 | |
| 4932 | cpplint._cpplint_state._junit_errors = [] |
| 4933 | cpplint._cpplint_state._junit_failures = [ |
| 4934 | ("File1", 5, "FailMsg1", "category/subcategory", 3), |
| 4935 | ("File2", 99, "FailMsg2", "category/subcategory", 3), |
| 4936 | ("File1", 19, "FailMsg3", "category/subcategory", 3), |
| 4937 | ] |
| 4938 | expected = ( |
| 4939 | '<?xml version="1.0" encoding="UTF-8" ?>\n' |
| 4940 | '<testsuite errors="0" failures="3" name="cpplint" tests="3">' |
| 4941 | '<testcase name="File1"><failure>5: FailMsg1 [category/subcategory]' |
| 4942 | " [3]\n19: FailMsg3 [category/subcategory] [3]</failure></testcase>" |
| 4943 | '<testcase name="File2"><failure>99: FailMsg2 ' |
| 4944 | "[category/subcategory] [3]</failure></testcase></testsuite>" |
nothing calls this directly
no test coverage detected