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 library test.computer.element; | 5 library test.computer.element; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 | 8 |
9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
10 import 'package:analysis_server/src/protocol_server.dart'; | 10 import 'package:analysis_server/src/protocol_server.dart'; |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 expect(element.parameters, isNull); | 510 expect(element.parameters, isNull); |
511 expect(element.returnType, isNull); | 511 expect(element.returnType, isNull); |
512 expect(element.flags, 0); | 512 expect(element.flags, 0); |
513 } | 513 } |
514 | 514 |
515 void test_fromElement_METHOD() { | 515 void test_fromElement_METHOD() { |
516 engine.Source source = addSource( | 516 engine.Source source = addSource( |
517 '/test.dart', | 517 '/test.dart', |
518 ''' | 518 ''' |
519 class A { | 519 class A { |
520 static List<String> myMethod(int a, {String b}) { | 520 static List<String> myMethod(int a, {String b, int c}) { |
521 return null; | 521 return null; |
522 } | 522 } |
523 }'''); | 523 }'''); |
524 engine.CompilationUnit unit = resolveLibraryUnit(source); | 524 engine.CompilationUnit unit = resolveLibraryUnit(source); |
525 engine.MethodElement engineElement = findElementInUnit(unit, 'myMethod'); | 525 engine.MethodElement engineElement = findElementInUnit(unit, 'myMethod'); |
526 // create notification Element | 526 // create notification Element |
527 Element element = newElement_fromEngine(engineElement); | 527 Element element = newElement_fromEngine(engineElement); |
528 expect(element.kind, ElementKind.METHOD); | 528 expect(element.kind, ElementKind.METHOD); |
529 expect(element.name, 'myMethod'); | 529 expect(element.name, 'myMethod'); |
530 { | 530 { |
531 Location location = element.location; | 531 Location location = element.location; |
532 expect(location.file, '/test.dart'); | 532 expect(location.file, '/test.dart'); |
533 expect(location.offset, 32); | 533 expect(location.offset, 32); |
534 expect(location.length, 'myGetter'.length); | 534 expect(location.length, 'myGetter'.length); |
535 expect(location.startLine, 2); | 535 expect(location.startLine, 2); |
536 expect(location.startColumn, 23); | 536 expect(location.startColumn, 23); |
537 } | 537 } |
538 expect(element.parameters, '(int a, {String b})'); | 538 expect(element.parameters, '(int a, {String b, int c})'); |
539 expect(element.returnType, 'List<String>'); | 539 expect(element.returnType, 'List<String>'); |
540 expect(element.flags, Element.FLAG_STATIC); | 540 expect(element.flags, Element.FLAG_STATIC); |
541 } | 541 } |
542 | 542 |
543 void test_fromElement_SETTER() { | 543 void test_fromElement_SETTER() { |
544 engine.Source source = addSource( | 544 engine.Source source = addSource( |
545 '/test.dart', | 545 '/test.dart', |
546 ''' | 546 ''' |
547 class A { | 547 class A { |
548 set mySetter(String x) {} | 548 set mySetter(String x) {} |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 ApiEnum apiValue = convert(engineValue); | 644 ApiEnum apiValue = convert(engineValue); |
645 expect(apiValue, equals(expectedResult)); | 645 expect(apiValue, equals(expectedResult)); |
646 } | 646 } |
647 } else { | 647 } else { |
648 ApiEnum apiValue = convert(engineValue); | 648 ApiEnum apiValue = convert(engineValue); |
649 expect(apiValue.name, equals(enumName)); | 649 expect(apiValue.name, equals(enumName)); |
650 } | 650 } |
651 }); | 651 }); |
652 } | 652 } |
653 } | 653 } |
OLD | NEW |