aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest/review.testscript
blob: e3daa66e8d50d49eee27b2535a6793f88a6c16db (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# file      : tests/manifest/review.testscript
# license   : MIT; see accompanying LICENSE file

: single-manifest
:
{
  test.options += -r

  : valid
  :
  : Roundtrip the review manifest.
  :
  {
    $* <<EOF >>EOF
    : 1
    reviewed-by: John Doe <john@doe.com>
    result-code: pass
    result-build: fail
    result-doc: unchanged
    base-version: 1.0.2+3
    details-url: https://example.com/issues/1
    EOF
  }

  : unknown-name
  :
  {
    $* <<EOI 2>"stdin:2:1: error: unknown name 'unknown-name' in review manifest" != 0
    : 1
    unknown-name: John Doe <john@doe.com>
    EOI
  }

  : redefinition
  :
  {
    : reviewed-by
    :
    {
      $* <<EOI 2>"stdin:3:1: error: reviewer redefinition" != 0
      : 1
      reviewed-by: John Doe <john@doe.com>
      reviewed-by: John Doe <john@doe.com>
      EOI
    }

    : result-code
    :
    {
      $* <<EOI 2>"stdin:3:1: error: code review result redefinition" != 0
      : 1
      result-code: pass
      result-code: fail
      EOI
    }
  }

  : invalid
  :
  {
    : reviewed-by-empty
    :
    {
      $* <<EOI 2>"stdin:2:13: error: empty reviewer" != 0
      : 1
      reviewed-by:
      EOI
    }

    : result-code
    :
    {
      $* <<EOI 2>"stdin:2:14: error: invalid review result 'fails'" != 0
      : 1
      result-code: fails
      EOI
    }

    : details-url
    :
    {
      $* <<EOI 2>"stdin:2:13: error: empty URL" != 0
        : 1
        details-url:
        EOI
    }
  }

  : mandatory
  :
  {
    : reviewed-by
    :
    {
      $* <<EOI 2>"stdin:2:1: error: no reviewer specified" != 0
      : 1
      EOI
    }

    : no-result
    :
    {
      $* <<EOI 2>"stdin:3:1: error: no result specified" != 0
        : 1
        reviewed-by: John Doe <john@doe.com>
        EOI
    }

    : no-base-version
    :
    {
      $* <<EOI 2>"stdin:4:1: error: no base version specified" != 0
        : 1
        reviewed-by: John Doe <john@doe.com>
        result-code: unchanged
        EOI
    }

    : no-details-url
    :
    {
      $* <<EOI 2>"stdin:4:1: error: no details url specified" != 0
        : 1
        reviewed-by: John Doe <john@doe.com>
        result-code: fail
        EOI
    }
  }
}

: multiple-manifests
:
{
  test.options += -rl

  : valid-manifest-list
  :
  : Roundtrip the review manifests list.
  :
  {
    $* <<EOF >>EOF
    : 1
    reviewed-by: John Doe <john@doe.com>
    result-code: pass
    :
    reviewed-by: John Doe <john@doe.com>
    result-build: pass
    EOF
  }

  : empty-manifest-list
  :
  : Roundtrip the empty manifests list.
  :
  {
    $* <:'' >:''
  }

    : no-details-url
    :
    {
      $* <<EOI 2>"stdin:7:1: error: no details url specified" != 0
        : 1
        reviewed-by: John Doe <john@doe.com>
        result-build: pass
        :
        reviewed-by: John Doe <john@doe.com>
        result-code: fail
        EOI
    }
}