aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py
blob: c212e4906bb0e99fedc123146a255d49989caf10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Verify that execution paths work in HTML output.

from htmltest import *

import pytest

@pytest.fixture(scope='function', autouse=True)
def html_tree():
    return html_tree_from_env()

XHTML = 'http://www.w3.org/1999/xhtml'
ns = {'xhtml': XHTML}

def make_tag(local_name):
    return f'{{{XHTML}}}' + local_name

def test_paths(html_tree):
    root = html_tree.getroot ()
    assert root.tag == make_tag('html')

    body = root.find('xhtml:body', ns)
    assert body is not None

    diag_list = body.find('xhtml:div', ns)
    assert diag_list is not None
    assert diag_list.attrib['class'] == 'gcc-diagnostic-list'

    diag = diag_list.find('xhtml:div', ns)
    assert diag is not None
    assert diag.attrib['class'] == 'gcc-diagnostic'

    pre = diag.findall('xhtml:pre', ns)
    assert pre[0].attrib['class'] == 'gcc-annotated-source'
    assert pre[1].attrib['class'] == 'gcc-execution-path'
    assert pre[1].text.startswith("  'make_a_list_of_random_ints_badly': events 1-3")