~ubuntu-branches/debian/experimental/gtksourceview4/experimental

« back to all changes in this revision

Viewing changes to tests/syntax-highlighting/file.groovy

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2018-03-11 11:53:30 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20180311115330-h6wv6v2vvc7sp86p
Tags: 4.0.0-1
* New upstream release (Closes: #876066)
* Update Vcs fields for migration to https://salsa.debian.org/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env groovy
 
2
 
 
3
// Single-line comment. TODO markers work.
 
4
/* Multi-line comment.
 
5
   TODO markers work. */
 
6
 
 
7
'line' \
 
8
    + 'continuation'
 
9
 
 
10
def tsq = '''Triple single-quoted string.
 
11
 
 
12
    Escapes work: \' \n \123 \u12ab \
 
13
    Interpolation doesn't work: $x ${x}
 
14
'''
 
15
 
 
16
def sq = 'Single-quoted string. Escapes work: \' \r \45 \u45CD \
 
17
    Interpolation does not: $x ${x}'
 
18
 
 
19
def tdq = """Triple double-quoted string.
 
20
 
 
21
    Escapes work: \" \f \6 \uABCD \
 
22
    Interpolation works: $x._y.z0 ${x + 5}
 
23
"""
 
24
 
 
25
def dq = "Double-quoted string. Escapes work: \" \b \7 \u5678 \
 
26
    So does interpolation: $_abc1 ${x + "abc"}"
 
27
 
 
28
def slashy = /Slashy string.
 
29
 
 
30
    There are only two escape sequences: \/ \
 
31
    Interpolation works: $X ${-> X}
 
32
    Dollars $ and backslashes \ on their own are interpreted literally./
 
33
 
 
34
def notSlashy = 1 /2/ 3 // not a slashy string; just two division operators
 
35
 
 
36
def dollarSlashy = $/Dollar slashy string.
 
37
 
 
38
    There are three escape sequences: $$ $/ \
 
39
    Interpolation works: $_ ${true}
 
40
    Dollars $ and backslashes \ on their own are interpreted literally./$
 
41
 
 
42
0b10i + 0b0110_1011 // binary numbers
 
43
0 + 123L + 456_789 // decimal numbers
 
44
0xab + 0xcd_efG // hexadecimal numbers
 
45
 
 
46
01_23.45_67g + 1e-23f + 2d + 08.80 // floating-point numbers
 
47
 
 
48
trait Test {
 
49
    void foo(List list) {
 
50
        def sum = 0
 
51
        for (n in list) sum += n as int
 
52
        println sum
 
53
    }
 
54
}
 
55