| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// End-to-end test of the analyzer2dart compiler. | 5 /// End-to-end test of the analyzer2dart compiler. |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'mock_sdk.dart'; | 9 import 'mock_sdk.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 main() { | 236 main() { |
| 237 var a = ""; | 237 var a = ""; |
| 238 return a.foo(0, 1); | 238 return a.foo(0, 1); |
| 239 } | 239 } |
| 240 ''', ''' | 240 ''', ''' |
| 241 main() { | 241 main() { |
| 242 return "".foo(0, 1); | 242 return "".foo(0, 1); |
| 243 } | 243 } |
| 244 '''); | 244 '''); |
| 245 }); | 245 }); |
| 246 |
| 247 test('Binary expressions', () { |
| 248 checkResult(''' |
| 249 main(a) { |
| 250 return a + deprecated; |
| 251 } |
| 252 ''', ''' |
| 253 main(a) { |
| 254 return a + deprecated; |
| 255 } |
| 256 '''); |
| 257 |
| 258 checkResult(''' |
| 259 main(a) { |
| 260 return a - deprecated; |
| 261 } |
| 262 ''', ''' |
| 263 main(a) { |
| 264 return a - deprecated; |
| 265 } |
| 266 '''); |
| 267 |
| 268 checkResult(''' |
| 269 main(a) { |
| 270 return a * deprecated; |
| 271 } |
| 272 ''', ''' |
| 273 main(a) { |
| 274 return a * deprecated; |
| 275 } |
| 276 '''); |
| 277 |
| 278 checkResult(''' |
| 279 main(a) { |
| 280 return a / deprecated; |
| 281 } |
| 282 ''', ''' |
| 283 main(a) { |
| 284 return a / deprecated; |
| 285 } |
| 286 '''); |
| 287 |
| 288 checkResult(''' |
| 289 main(a) { |
| 290 return a ~/ deprecated; |
| 291 } |
| 292 ''', ''' |
| 293 main(a) { |
| 294 return a ~/ deprecated; |
| 295 } |
| 296 '''); |
| 297 |
| 298 checkResult(''' |
| 299 main(a) { |
| 300 return a % deprecated; |
| 301 } |
| 302 ''', ''' |
| 303 main(a) { |
| 304 return a % deprecated; |
| 305 } |
| 306 '''); |
| 307 |
| 308 checkResult(''' |
| 309 main(a) { |
| 310 return a < deprecated; |
| 311 } |
| 312 ''', ''' |
| 313 main(a) { |
| 314 return a < deprecated; |
| 315 } |
| 316 '''); |
| 317 |
| 318 checkResult(''' |
| 319 main(a) { |
| 320 return a <= deprecated; |
| 321 } |
| 322 ''', ''' |
| 323 main(a) { |
| 324 return a <= deprecated; |
| 325 } |
| 326 '''); |
| 327 |
| 328 checkResult(''' |
| 329 main(a) { |
| 330 return a > deprecated; |
| 331 } |
| 332 ''', ''' |
| 333 main(a) { |
| 334 return a > deprecated; |
| 335 } |
| 336 '''); |
| 337 |
| 338 checkResult(''' |
| 339 main(a) { |
| 340 return a >= deprecated; |
| 341 } |
| 342 ''', ''' |
| 343 main(a) { |
| 344 return a >= deprecated; |
| 345 } |
| 346 '''); |
| 347 |
| 348 checkResult(''' |
| 349 main(a) { |
| 350 return a << deprecated; |
| 351 } |
| 352 ''', ''' |
| 353 main(a) { |
| 354 return a << deprecated; |
| 355 } |
| 356 '''); |
| 357 |
| 358 checkResult(''' |
| 359 main(a) { |
| 360 return a >> deprecated; |
| 361 } |
| 362 ''', ''' |
| 363 main(a) { |
| 364 return a >> deprecated; |
| 365 } |
| 366 '''); |
| 367 |
| 368 checkResult(''' |
| 369 main(a) { |
| 370 return a & deprecated; |
| 371 } |
| 372 ''', ''' |
| 373 main(a) { |
| 374 return a & deprecated; |
| 375 } |
| 376 '''); |
| 377 |
| 378 checkResult(''' |
| 379 main(a) { |
| 380 return a | deprecated; |
| 381 } |
| 382 ''', ''' |
| 383 main(a) { |
| 384 return a | deprecated; |
| 385 } |
| 386 '''); |
| 387 |
| 388 checkResult(''' |
| 389 main(a) { |
| 390 return a ^ deprecated; |
| 391 } |
| 392 ''', ''' |
| 393 main(a) { |
| 394 return a ^ deprecated; |
| 395 } |
| 396 '''); |
| 397 |
| 398 checkResult(''' |
| 399 main(a) { |
| 400 return a == deprecated; |
| 401 } |
| 402 ''', ''' |
| 403 main(a) { |
| 404 return a == deprecated; |
| 405 } |
| 406 '''); |
| 407 |
| 408 checkResult(''' |
| 409 main(a) { |
| 410 return a != deprecated; |
| 411 } |
| 412 ''', ''' |
| 413 main(a) { |
| 414 return !(a == deprecated); |
| 415 } |
| 416 '''); |
| 417 |
| 418 checkResult(''' |
| 419 main(a) { |
| 420 return a || deprecated; |
| 421 } |
| 422 ''', ''' |
| 423 main(a) { |
| 424 return a || deprecated; |
| 425 } |
| 426 '''); |
| 427 |
| 428 checkResult(''' |
| 429 main(a) { |
| 430 return a && deprecated; |
| 431 } |
| 432 ''', ''' |
| 433 main(a) { |
| 434 return a && deprecated; |
| 435 } |
| 436 '''); |
| 437 }); |
| 246 } | 438 } |
| 247 | 439 |
| 248 checkResult(String input, [String expectedOutput]) { | 440 checkResult(String input, [String expectedOutput]) { |
| 249 if (expectedOutput == null) { | 441 if (expectedOutput == null) { |
| 250 expectedOutput = input; | 442 expectedOutput = input; |
| 251 } | 443 } |
| 252 | 444 |
| 253 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); | 445 CollectingOutputProvider outputProvider = new CollectingOutputProvider(); |
| 254 MemoryResourceProvider provider = new MemoryResourceProvider(); | 446 MemoryResourceProvider provider = new MemoryResourceProvider(); |
| 255 DartSdk sdk = new MockSdk(); | 447 DartSdk sdk = new MockSdk(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 280 sb.write(text); | 472 sb.write(text); |
| 281 } | 473 } |
| 282 | 474 |
| 283 void addError(errorEvent, [StackTrace stackTrace]) {} | 475 void addError(errorEvent, [StackTrace stackTrace]) {} |
| 284 | 476 |
| 285 void close() {} | 477 void close() {} |
| 286 | 478 |
| 287 String get text => sb.toString(); | 479 String get text => sb.toString(); |
| 288 } | 480 } |
| 289 | 481 |
| OLD | NEW |