def test_if_defined_space_before_newline():
    contents = '''
#if !defined(MATCH_H) 
#define MATCH_H
'''
    s,e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 39)
Example #2
0
def test_ok_space_before_hash():
    contents = '''
 #ifndef MATCH_H
#define MATCH_H
'''
    s,e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 33)
Example #3
0
def test_ok():
    contents = '''
#ifndef MATCH_H
#define MATCH_H
'''
    s,e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 32)
Example #4
0
def test_define_with_value_1():
    contents = '''
#ifndef MATCH_H
#define MATCH_H 1
'''
    s,e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 34)
Example #5
0
def test_define_with_value_1():
    contents = '''
#ifndef MATCH_H
#define MATCH_H 1
'''
    s, e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 34)
Example #6
0
def test_ok_space_before_hash():
    contents = '''
 #ifndef MATCH_H
#define MATCH_H
'''
    s, e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 33)
Example #7
0
def test_extra_whitespace_on_define():
    contents = '''
#ifndef MATCH_H
#define MATCH_H 
'''
    s,e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 33)
Example #8
0
def test_extra_whitespace_on_define():
    contents = '''
#ifndef MATCH_H
#define MATCH_H 
'''
    s, e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 33)
Example #9
0
def test_ok():
    contents = '''
#ifndef MATCH_H
#define MATCH_H
'''
    s, e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 32)
def test_if_defined_no_parentheses():
    contents = '''
#if !defined MATCH_H
#define MATCH_H
'''
    s,e = go.index_guard_start(contents, 'MATCH_H')
    assert_equals(s, 1)
    assert_equals(e, 37)
Example #11
0
def test_mismatched_define_symbol():
    contents = '''
#ifndef MATCH_H
#define MISMATCH_H
'''
    go.index_guard_start(contents, 'MATCH_H')
Example #12
0
def test_no_define():
    contents = '''
#ifndef MATCH_H
#defne MATCH_H
'''
    go.index_guard_start(contents, 'MATCH_H')
Example #13
0
def test_bad_symbol_substring():
    contents = '''
#ifndef MISMATCH_H
#define MISMATCH_H
'''
    go.index_guard_start(contents, 'STRING_H')
Example #14
0
def test_mismatched_define_symbol():
    contents = '''
#ifndef MATCH_H
#define MISMATCH_H
'''
    go.index_guard_start(contents, 'MATCH_H')
Example #15
0
def test_no_define():
    contents = '''
#ifndef MATCH_H
#defne MATCH_H
'''
    go.index_guard_start(contents, 'MATCH_H')
Example #16
0
def test_bad_symbol_substring():
    contents = '''
#ifndef MISMATCH_H
#define MISMATCH_H
'''
    go.index_guard_start(contents, 'STRING_H')
def test_if_defined_extra_junk_in_defined():
    contents = '''
#if !defined(MATCH_H WEIRD_HUH)
#define MATCH_H
'''
    go.index_guard_start(contents, 'MATCH_H')
def test_if_defined_extra_junk_before_newline():
    contents = '''
#if !defined(MATCH_H) WEIRD_HUH
#define MATCH_H
'''
    go.index_guard_start(contents, 'MATCH_H')
Example #19
0
def test_extra_junk_on_define():
    contents = '''
#ifndef MATCH_H
#define MATCH_H WEIRD_HUH
'''
    go.index_guard_start(contents, 'MATCH_H')
Example #20
0
def test_extra_junk_on_define():
    contents = '''
#ifndef MATCH_H
#define MATCH_H WEIRD_HUH
'''
    go.index_guard_start(contents, 'MATCH_H')