summaryrefslogtreecommitdiff
path: root/tests/suite/syntax/newlines.typ
blob: eef4561920ad3a479bbcb1122d06ade4ec7896be (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Test newline continuations.

--- newline-continuation-code ---
#{
  "hello"
    .clusters()
  if false {

  }
  else {
    ("1", "2")
  }
}

--- newline-continuation-markup ---
#"hello"
  .codepoints()

#if false {

}
else {
  ("1", "2")
}

--- newline-continuation-method-blank ---
#test({
  "hi 1"

    .clusters()
}, ("h", "i", " ", "1"))

--- newline-continuation-method-line-comment-after ---
#test({
  "hi 2"// comment
    .clusters()
}, ("h", "i", " ", "2"))

--- newline-continuation-method-block-comment-after ---
#test({
  "hi 3"/* comment */
    .clusters()
}, ("h", "i", " ", "3"))

--- newline-continuation-method-line-comment-between ---
#test({
  "hi 4"
  // comment
    .clusters()
}, ("h", "i", " ", "4"))

--- newline-continuation-method-block-comment-between ---
#test({
  "hi 5"
  /*comment*/.clusters()
}, ("h", "i", " ", "5"))

--- newline-continuation-method-comments-and-blanks ---
#test({
  "hi 6"
  // comment


  /* comment */
    .clusters()
}, ("h", "i", " ", "6"))

--- newline-continuation-if-else-comment ---
#test({
  let foo(x) = {
    if x < 0 { "negative" }
    // comment
    else { "non-negative" }
  }

  foo(1)
}, "non-negative")