diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/html-output/missing-semicolon.py')
-rw-r--r-- | gcc/testsuite/gcc.dg/html-output/missing-semicolon.py | 93 |
1 files changed, 58 insertions, 35 deletions
diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py index 02ff84c..3adaa52 100644 --- a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py +++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py @@ -26,7 +26,7 @@ def test_basics(html_tree): assert head is not None title = head.find('xhtml:title', ns) - assert title.text == 'Title goes here' + assert title.text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c') body = root.find('xhtml:body', ns) assert body is not None @@ -37,45 +37,68 @@ def test_basics(html_tree): diag = diag_list.find('xhtml:div', ns) assert diag is not None - assert diag.attrib['class'] == 'gcc-diagnostic' + assert diag.attrib['class'] == 'alert alert-danger' + assert diag.attrib['id'] == 'gcc-diag-0' - message = diag.find('xhtml:span', ns) + icon = diag.find('xhtml:span', ns) + assert icon.attrib['class'] == 'pficon pficon-error-circle-o' + + # The message line: + message = diag.find("./xhtml:div[@class='gcc-message']", ns) assert message is not None - assert message.attrib['class'] == 'gcc-message' - assert message.text == "expected '" - assert message[0].tag == make_tag('span') - assert message[0].attrib['class'] == 'gcc-quoted-text' - assert message[0].text == ';' - assert message[0].tail == "' before '" + # <html:div xmlns:html="http://www.w3.org/1999/xhtml" class="gcc-message" id="gcc-diag-0-message"><html:strong>error: </html:strong> expected '<html:span class="gcc-quoted-text">;</html:span>' before '<html:span class="gcc-quoted-text">}</html:span>' token</html:div> + assert message[0].tag == make_tag('strong') + assert message[0].text == 'error: ' + assert message[0].tail == " expected '" assert message[1].tag == make_tag('span') assert message[1].attrib['class'] == 'gcc-quoted-text' - assert message[1].text == '}' - assert message[1].tail == "' token" + assert message[1].text == ';' + assert message[1].tail == "' before '" + assert message[2].tag == make_tag('span') + assert message[2].attrib['class'] == 'gcc-quoted-text' + assert message[2].text == '}' + assert message[2].tail == "' token" + + # Logical location + logical_loc = diag.find("./xhtml:div[@id='logical-location']", ns) + assert logical_loc is not None + assert len(logical_loc) == 2 + assert logical_loc[0].tag == make_tag('span') + assert logical_loc[0].text == 'Function ' + assert logical_loc[1].tag == make_tag('span') + assert logical_loc[1].text == 'missing_semicolon' + assert logical_loc[1].attrib['class'] == 'gcc-quoted-text' + + # Physical location + file_ = diag.find("./xhtml:div[@id='file']", ns) + assert file_ is not None + assert len(file_) == 2 + assert file_[0].tag == make_tag('span') + assert file_[0].text == 'File ' + assert file_[1].tag == make_tag('span') + assert file_[1].text.endswith('gcc/testsuite/gcc.dg/html-output/missing-semicolon.c') - pre = diag.find('xhtml:pre', ns) + line = diag.find("./xhtml:div[@id='line']", ns) + assert line is not None + assert len(line) == 2 + assert line[0].tag == make_tag('span') + assert line[0].text == 'Line ' + assert line[1].tag == make_tag('span') + assert line[1].text == '8' + + column = diag.find("./xhtml:div[@id='column']", ns) + assert column is not None + assert len(column) == 2 + assert column[0].tag == make_tag('span') + assert column[0].text == 'Column ' + assert column[1].tag == make_tag('span') + assert column[1].text == '12' + + # Suggested fix + fix = diag.find("./xhtml:div[@id='suggested-fix']", ns) + label = fix.find('xhtml:label', ns) + assert label.text == "Suggested fix" + pre = fix.find('xhtml:pre', ns) assert pre is not None assert pre.attrib['class'] == 'gcc-generated-patch' assert pre.text.startswith('--- ') - -# For reference, here's the generated HTML: -""" -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title>Title goes here</title> - </head> - <body> - <div class="gcc-diagnostic-list"> - <div class="gcc-diagnostic"> - <span class="gcc-message">expected '<span class="gcc-quoted-text">;</span>' before '<span class="gcc-quoted-text">}</span>' token</span> - <pre class="gcc-generated-patch"> - [...snip...] - </pre> - </div> - </div> - </body> -</html> -""" |