| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 @TestOn("vm") | 5 @TestOn("vm") |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:scheduled_test/descriptor.dart' as d; | 9 import 'package:scheduled_test/descriptor.dart' as d; |
| 10 import 'package:scheduled_test/scheduled_test.dart'; | 10 import 'package:scheduled_test/scheduled_test.dart'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 })).create(); | 35 })).create(); |
| 36 | 36 |
| 37 var test = runTest(["test.dart"]); | 37 var test = runTest(["test.dart"]); |
| 38 test.stderr.expect(containsInOrder([ | 38 test.stderr.expect(containsInOrder([ |
| 39 "js_trace must be a boolean", | 39 "js_trace must be a boolean", |
| 40 "^^^^^^" | 40 "^^^^^^" |
| 41 ])); | 41 ])); |
| 42 test.shouldExit(exit_codes.data); | 42 test.shouldExit(exit_codes.data); |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 test("rejects an invalid reporter type", () { | 45 group("reporter", () { |
| 46 d.file("dart_test.yaml", JSON.encode({ | 46 test("rejects an invalid type", () { |
| 47 "reporter": 12 | 47 d.file("dart_test.yaml", JSON.encode({ |
| 48 })).create(); | 48 "reporter": 12 |
| 49 })).create(); |
| 49 | 50 |
| 50 var test = runTest(["test.dart"]); | 51 var test = runTest(["test.dart"]); |
| 51 test.stderr.expect(containsInOrder([ | 52 test.stderr.expect(containsInOrder([ |
| 52 "reporter must be a string", | 53 "reporter must be a string", |
| 53 "^^" | 54 "^^" |
| 54 ])); | 55 ])); |
| 55 test.shouldExit(exit_codes.data); | 56 test.shouldExit(exit_codes.data); |
| 56 }); | 57 }); |
| 57 | 58 |
| 58 test("rejects an invalid reporter name", () { | 59 test("rejects an invalid name", () { |
| 59 d.file("dart_test.yaml", JSON.encode({ | 60 d.file("dart_test.yaml", JSON.encode({ |
| 60 "reporter": "non-existent" | 61 "reporter": "non-existent" |
| 61 })).create(); | 62 })).create(); |
| 62 | 63 |
| 63 var test = runTest(["test.dart"]); | 64 var test = runTest(["test.dart"]); |
| 64 test.stderr.expect(containsInOrder([ | 65 test.stderr.expect(containsInOrder([ |
| 65 'Unknown reporter "non-existent"', | 66 'Unknown reporter "non-existent"', |
| 66 "^^^^^^^^^^^^^^" | 67 "^^^^^^^^^^^^^^" |
| 67 ])); | 68 ])); |
| 68 test.shouldExit(exit_codes.data); | 69 test.shouldExit(exit_codes.data); |
| 70 }); |
| 69 }); | 71 }); |
| 70 | 72 |
| 71 test("rejects an invalid pub serve port", () { | 73 test("rejects an invalid pub serve port", () { |
| 72 d.file("dart_test.yaml", JSON.encode({ | 74 d.file("dart_test.yaml", JSON.encode({ |
| 73 "pub_serve": "foo" | 75 "pub_serve": "foo" |
| 74 })).create(); | 76 })).create(); |
| 75 | 77 |
| 76 var test = runTest(["test.dart"]); | 78 var test = runTest(["test.dart"]); |
| 77 test.stderr.expect(containsInOrder([ | 79 test.stderr.expect(containsInOrder([ |
| 78 "pub_serve must be an int", | 80 "pub_serve must be an int", |
| 79 "^^^^^" | 81 "^^^^^" |
| 80 ])); | 82 ])); |
| 81 test.shouldExit(exit_codes.data); | 83 test.shouldExit(exit_codes.data); |
| 82 }); | 84 }); |
| 83 | 85 |
| 84 test("rejects an invalid concurrency", () { | 86 test("rejects an invalid concurrency", () { |
| 85 d.file("dart_test.yaml", JSON.encode({ | 87 d.file("dart_test.yaml", JSON.encode({ |
| 86 "concurrency": "foo" | 88 "concurrency": "foo" |
| 87 })).create(); | 89 })).create(); |
| 88 | 90 |
| 89 var test = runTest(["test.dart"]); | 91 var test = runTest(["test.dart"]); |
| 90 test.stderr.expect(containsInOrder([ | 92 test.stderr.expect(containsInOrder([ |
| 91 "concurrency must be an int", | 93 "concurrency must be an int", |
| 92 "^^^^^" | 94 "^^^^^" |
| 93 ])); | 95 ])); |
| 94 test.shouldExit(exit_codes.data); | 96 test.shouldExit(exit_codes.data); |
| 95 }); | 97 }); |
| 96 | 98 |
| 97 test("rejects an invalid timeout type", () { | 99 group("timeout", () { |
| 98 d.file("dart_test.yaml", JSON.encode({ | 100 test("rejects an invalid type", () { |
| 99 "timeout": 12 | 101 d.file("dart_test.yaml", JSON.encode({ |
| 100 })).create(); | 102 "timeout": 12 |
| 101 | 103 })).create(); |
| 102 var test = runTest(["test.dart"]); | 104 |
| 103 test.stderr.expect(containsInOrder([ | 105 var test = runTest(["test.dart"]); |
| 104 "timeout must be a string", | 106 test.stderr.expect(containsInOrder([ |
| 105 "^^" | 107 "timeout must be a string", |
| 106 ])); | 108 "^^" |
| 107 test.shouldExit(exit_codes.data); | 109 ])); |
| 108 }); | 110 test.shouldExit(exit_codes.data); |
| 109 | 111 }); |
| 110 test("rejects an invalid timeout format", () { | 112 |
| 111 d.file("dart_test.yaml", JSON.encode({ | 113 test("rejects an invalid format", () { |
| 112 "timeout": "12p" | 114 d.file("dart_test.yaml", JSON.encode({ |
| 113 })).create(); | 115 "timeout": "12p" |
| 114 | 116 })).create(); |
| 115 var test = runTest(["test.dart"]); | 117 |
| 116 test.stderr.expect(containsInOrder([ | 118 var test = runTest(["test.dart"]); |
| 117 "Invalid timeout: expected unit", | 119 test.stderr.expect(containsInOrder([ |
| 118 "^^^^^" | 120 "Invalid timeout: expected unit", |
| 119 ])); | 121 "^^^^^" |
| 120 test.shouldExit(exit_codes.data); | 122 ])); |
| 121 }); | 123 test.shouldExit(exit_codes.data); |
| 122 | 124 }); |
| 123 test("rejects an invalid platforms list type", () { | 125 }); |
| 124 d.file("dart_test.yaml", JSON.encode({ | 126 |
| 125 "platforms": "vm" | 127 group("names", () { |
| 126 })).create(); | 128 test("rejects an invalid list type", () { |
| 127 | 129 d.file("dart_test.yaml", JSON.encode({ |
| 128 var test = runTest(["test.dart"]); | 130 "names": "vm" |
| 129 test.stderr.expect(containsInOrder([ | 131 })).create(); |
| 130 "platforms must be a list", | 132 |
| 131 "^^^^" | 133 var test = runTest(["test.dart"]); |
| 132 ])); | 134 test.stderr.expect(containsInOrder([ |
| 133 test.shouldExit(exit_codes.data); | 135 "names must be a list", |
| 134 }); | 136 "^^^^" |
| 135 | 137 ])); |
| 136 test("rejects an invalid platforms member type", () { | 138 test.shouldExit(exit_codes.data); |
| 137 d.file("dart_test.yaml", JSON.encode({ | 139 }); |
| 138 "platforms": [12] | 140 |
| 139 })).create(); | 141 test("rejects an invalid member type", () { |
| 140 | 142 d.file("dart_test.yaml", JSON.encode({ |
| 141 var test = runTest(["test.dart"]); | 143 "names": [12] |
| 142 test.stderr.expect(containsInOrder([ | 144 })).create(); |
| 143 "Platforms must be strings", | 145 |
| 144 "^^" | 146 var test = runTest(["test.dart"]); |
| 145 ])); | 147 test.stderr.expect(containsInOrder([ |
| 146 test.shouldExit(exit_codes.data); | 148 "Names must be strings", |
| 147 }); | 149 "^^" |
| 148 | 150 ])); |
| 149 test("rejects an invalid platforms member name", () { | 151 test.shouldExit(exit_codes.data); |
| 150 d.file("dart_test.yaml", JSON.encode({ | 152 }); |
| 151 "platforms": ["foo"] | 153 |
| 152 })).create(); | 154 test("rejects an invalid RegExp", () { |
| 153 | 155 d.file("dart_test.yaml", JSON.encode({ |
| 154 var test = runTest(["test.dart"]); | 156 "names": ["(foo"] |
| 155 test.stderr.expect(containsInOrder([ | 157 })).create(); |
| 156 'Unknown platform "foo"', | 158 |
| 157 "^^^^^" | 159 var test = runTest(["test.dart"]); |
| 158 ])); | 160 test.stderr.expect(containsInOrder([ |
| 159 test.shouldExit(exit_codes.data); | 161 'Invalid name: Unterminated group(foo', |
| 160 }); | 162 "^^^^^^" |
| 161 | 163 ])); |
| 162 test("rejects an invalid paths list type", () { | 164 test.shouldExit(exit_codes.data); |
| 163 d.file("dart_test.yaml", JSON.encode({ | 165 }); |
| 164 "paths": "test" | 166 }); |
| 165 })).create(); | 167 |
| 166 | 168 group("plain_names", () { |
| 167 var test = runTest(["test.dart"]); | 169 test("rejects an invalid list type", () { |
| 168 test.stderr.expect(containsInOrder([ | 170 d.file("dart_test.yaml", JSON.encode({ |
| 169 "paths must be a list", | 171 "plain_names": "vm" |
| 170 "^^^^^^" | 172 })).create(); |
| 171 ])); | 173 |
| 172 test.shouldExit(exit_codes.data); | 174 var test = runTest(["test.dart"]); |
| 173 }); | 175 test.stderr.expect(containsInOrder([ |
| 174 | 176 "plain_names must be a list", |
| 175 test("rejects an invalid paths member type", () { | 177 "^^^^" |
| 176 d.file("dart_test.yaml", JSON.encode({ | 178 ])); |
| 177 "paths": [12] | 179 test.shouldExit(exit_codes.data); |
| 178 })).create(); | 180 }); |
| 179 | 181 |
| 180 var test = runTest(["test.dart"]); | 182 test("rejects an invalid member type", () { |
| 181 test.stderr.expect(containsInOrder([ | 183 d.file("dart_test.yaml", JSON.encode({ |
| 182 "Paths must be strings", | 184 "plain_names": [12] |
| 183 "^^" | 185 })).create(); |
| 184 ])); | 186 |
| 185 test.shouldExit(exit_codes.data); | 187 var test = runTest(["test.dart"]); |
| 186 }); | 188 test.stderr.expect(containsInOrder([ |
| 187 | 189 "Names must be strings", |
| 188 test("rejects an absolute path", () { | 190 "^^" |
| 189 d.file("dart_test.yaml", JSON.encode({ | 191 ])); |
| 190 "paths": ["/foo"] | 192 test.shouldExit(exit_codes.data); |
| 191 })).create(); | 193 }); |
| 192 | 194 }); |
| 193 var test = runTest(["test.dart"]); | 195 |
| 194 test.stderr.expect(containsInOrder([ | 196 group("platforms", () { |
| 195 'Paths must be relative.', | 197 test("rejects an invalid list type", () { |
| 196 "^^^^^^" | 198 d.file("dart_test.yaml", JSON.encode({ |
| 197 ])); | 199 "platforms": "vm" |
| 198 test.shouldExit(exit_codes.data); | 200 })).create(); |
| 199 }); | 201 |
| 200 | 202 var test = runTest(["test.dart"]); |
| 201 test("rejects an invalid path URI", () { | 203 test.stderr.expect(containsInOrder([ |
| 202 d.file("dart_test.yaml", JSON.encode({ | 204 "platforms must be a list", |
| 203 "paths": ["[invalid]"] | 205 "^^^^" |
| 204 })).create(); | 206 ])); |
| 205 | 207 test.shouldExit(exit_codes.data); |
| 206 var test = runTest(["test.dart"]); | 208 }); |
| 207 test.stderr.expect(containsInOrder([ | 209 |
| 208 'Invalid path: Invalid character', | 210 test("rejects an invalid member type", () { |
| 209 "^^^^^^^^^" | 211 d.file("dart_test.yaml", JSON.encode({ |
| 210 ])); | 212 "platforms": [12] |
| 211 test.shouldExit(exit_codes.data); | 213 })).create(); |
| 212 }); | 214 |
| 213 | 215 var test = runTest(["test.dart"]); |
| 214 test("rejects an invalid filename type", () { | 216 test.stderr.expect(containsInOrder([ |
| 215 d.file("dart_test.yaml", JSON.encode({ | 217 "Platforms must be strings", |
| 216 "filename": 12 | 218 "^^" |
| 217 })).create(); | 219 ])); |
| 218 | 220 test.shouldExit(exit_codes.data); |
| 219 var test = runTest(["test.dart"]); | 221 }); |
| 220 test.stderr.expect(containsInOrder([ | 222 |
| 221 'filename must be a string.', | 223 test("rejects an invalid member name", () { |
| 222 "^^" | 224 d.file("dart_test.yaml", JSON.encode({ |
| 223 ])); | 225 "platforms": ["foo"] |
| 224 test.shouldExit(exit_codes.data); | 226 })).create(); |
| 225 }); | 227 |
| 226 | 228 var test = runTest(["test.dart"]); |
| 227 test("rejects an invalid filename format", () { | 229 test.stderr.expect(containsInOrder([ |
| 228 d.file("dart_test.yaml", JSON.encode({ | 230 'Unknown platform "foo"', |
| 229 "filename": "{foo" | 231 "^^^^^" |
| 230 })).create(); | 232 ])); |
| 231 | 233 test.shouldExit(exit_codes.data); |
| 232 var test = runTest(["test.dart"]); | 234 }); |
| 233 test.stderr.expect(containsInOrder([ | 235 }); |
| 234 'Invalid filename: expected ",".', | 236 |
| 235 "^^^^^^" | 237 group("paths", () { |
| 236 ])); | 238 test("rejects an invalid list type", () { |
| 237 test.shouldExit(exit_codes.data); | 239 d.file("dart_test.yaml", JSON.encode({ |
| 240 "paths": "test" |
| 241 })).create(); |
| 242 |
| 243 var test = runTest(["test.dart"]); |
| 244 test.stderr.expect(containsInOrder([ |
| 245 "paths must be a list", |
| 246 "^^^^^^" |
| 247 ])); |
| 248 test.shouldExit(exit_codes.data); |
| 249 }); |
| 250 |
| 251 test("rejects an invalid member type", () { |
| 252 d.file("dart_test.yaml", JSON.encode({ |
| 253 "paths": [12] |
| 254 })).create(); |
| 255 |
| 256 var test = runTest(["test.dart"]); |
| 257 test.stderr.expect(containsInOrder([ |
| 258 "Paths must be strings", |
| 259 "^^" |
| 260 ])); |
| 261 test.shouldExit(exit_codes.data); |
| 262 }); |
| 263 |
| 264 test("rejects an absolute path", () { |
| 265 d.file("dart_test.yaml", JSON.encode({ |
| 266 "paths": ["/foo"] |
| 267 })).create(); |
| 268 |
| 269 var test = runTest(["test.dart"]); |
| 270 test.stderr.expect(containsInOrder([ |
| 271 'Paths must be relative.', |
| 272 "^^^^^^" |
| 273 ])); |
| 274 test.shouldExit(exit_codes.data); |
| 275 }); |
| 276 |
| 277 test("rejects an invalid URI", () { |
| 278 d.file("dart_test.yaml", JSON.encode({ |
| 279 "paths": ["[invalid]"] |
| 280 })).create(); |
| 281 |
| 282 var test = runTest(["test.dart"]); |
| 283 test.stderr.expect(containsInOrder([ |
| 284 'Invalid path: Invalid character', |
| 285 "^^^^^^^^^" |
| 286 ])); |
| 287 test.shouldExit(exit_codes.data); |
| 288 }); |
| 289 }); |
| 290 |
| 291 group("filename", () { |
| 292 test("rejects an invalid type", () { |
| 293 d.file("dart_test.yaml", JSON.encode({ |
| 294 "filename": 12 |
| 295 })).create(); |
| 296 |
| 297 var test = runTest(["test.dart"]); |
| 298 test.stderr.expect(containsInOrder([ |
| 299 'filename must be a string.', |
| 300 "^^" |
| 301 ])); |
| 302 test.shouldExit(exit_codes.data); |
| 303 }); |
| 304 |
| 305 test("rejects an invalid format", () { |
| 306 d.file("dart_test.yaml", JSON.encode({ |
| 307 "filename": "{foo" |
| 308 })).create(); |
| 309 |
| 310 var test = runTest(["test.dart"]); |
| 311 test.stderr.expect(containsInOrder([ |
| 312 'Invalid filename: expected ",".', |
| 313 "^^^^^^" |
| 314 ])); |
| 315 test.shouldExit(exit_codes.data); |
| 316 }); |
| 238 }); | 317 }); |
| 239 } | 318 } |
| OLD | NEW |