Exemplo n.º 1
0
def test_no_format():
    flags = []
    check_c_format('Hello, world', flags)
    assert flags == []
Exemplo n.º 2
0
def test_strftime_is_not_c_format():
    flags = []
    check_c_format('%Y-%m-%d', flags)
    assert 'c-format' not in flags
Exemplo n.º 3
0
def test_escaped_percent_sign():
    flags = []
    check_c_format('100%%', flags)
    assert 'c-format' not in flags
Exemplo n.º 4
0
def test_accept_no_format_hint():
    flags = ['no-c-format']
    check_c_format('Hello, %s', flags)
    assert 'c-format' not in flags
Exemplo n.º 5
0
def test_basic_c_format():
    flags = []
    check_c_format('Hello, %s', flags)
    assert 'c-format' in flags
Exemplo n.º 6
0
def test_space_in_format():
    # This is technically a violation: printf(3) allows a space in format
    # strings, but in the real world this leads to many false positives.
    flags = []
    check_c_format('This is 5% of everything', flags)
    assert flags == []