Ejemplo n.º 1
0
def test_triple_double_quote():
    source = r'''
    puts """Hello,
    "World"!"""
    '''
    assert parse(source) == [Call(Ident('puts'), [String('Hello,\n"World"!')])]
Ejemplo n.º 2
0
def test_single_quote_escape():
    source = r'''
    puts 'Hello, \'World!\''
    '''
    assert parse(source) == [Call(Ident('puts'), [String("Hello, 'World!'")])]
Ejemplo n.º 3
0
def test_single_multiline_quote():
    source = r'''
    puts 'Hello,
    World!'
    '''
    assert parse(source) == [Call(Ident('puts'), [String("Hello,\nWorld!")])]
Ejemplo n.º 4
0
def test_double_quote_escape_unquote():
    source = r'''
    puts "Hello, \$World!"
    '''
    assert parse(source) == [Call(Ident('puts'), [String('Hello, $World!')])]
Ejemplo n.º 5
0
def test_double_nested_quote():
    source = '''
    puts "Hello, 'World!'"
    '''
    assert parse(source) == [Call(Ident('puts'), [String("Hello, 'World!'")])]
Ejemplo n.º 6
0
def test_single_nested_quote():
    source = '''
    puts 'Hello, "World!"'
    '''
    assert parse(source) == [Call(Ident('puts'), [String('Hello, "World!"')])]
Ejemplo n.º 7
0
def test_simple_statement():
    source = '''
    puts "Hello, World!"
    '''
    assert parse(source) == [Call(Ident('puts'), [String('Hello, World!')])]
Ejemplo n.º 8
0
def test_call_expression():
    source = '''
    (puts "Hello, World!")
    '''
    assert parse(source) == [Call(Ident('puts'), [String('Hello, World!')])]