| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/dart/element/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/element/type.dart'; | 10 import 'package:analyzer/src/dart/element/type.dart'; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 expect(resynthesized.toDoubleValue(), original.toDoubleValue(), | 222 expect(resynthesized.toDoubleValue(), original.toDoubleValue(), |
| 223 reason: desc); | 223 reason: desc); |
| 224 } else if (original.toListValue() != null) { | 224 } else if (original.toListValue() != null) { |
| 225 fail('Not implemented'); | 225 fail('Not implemented'); |
| 226 } else if (original.toMapValue() != null) { | 226 } else if (original.toMapValue() != null) { |
| 227 fail('Not implemented'); | 227 fail('Not implemented'); |
| 228 } else if (original.toStringValue() != null) { | 228 } else if (original.toStringValue() != null) { |
| 229 expect(resynthesized.toStringValue(), original.toStringValue(), | 229 expect(resynthesized.toStringValue(), original.toStringValue(), |
| 230 reason: desc); | 230 reason: desc); |
| 231 } else if (original.toSymbolValue() != null) { | 231 } else if (original.toSymbolValue() != null) { |
| 232 fail('Not implemented'); | 232 expect(resynthesized.toSymbolValue(), original.toSymbolValue(), |
| 233 reason: desc); |
| 233 } else if (original.toTypeValue() != null) { | 234 } else if (original.toTypeValue() != null) { |
| 234 fail('Not implemented'); | 235 fail('Not implemented'); |
| 235 } | 236 } |
| 236 // TODO(scheglov) implement | 237 // TODO(scheglov) implement |
| 237 } | 238 } |
| 238 } | 239 } |
| 239 | 240 |
| 240 void compareConstructorElements(ConstructorElementImpl resynthesized, | 241 void compareConstructorElements(ConstructorElementImpl resynthesized, |
| 241 ConstructorElementImpl original, String desc) { | 242 ConstructorElementImpl original, String desc) { |
| 242 compareExecutableElements(resynthesized, original, desc); | 243 compareExecutableElements(resynthesized, original, desc); |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 } | 946 } |
| 946 | 947 |
| 947 test_class_type_parameters_f_bound_simple() { | 948 test_class_type_parameters_f_bound_simple() { |
| 948 checkLibrary('class C<T extends U, U> {}'); | 949 checkLibrary('class C<T extends U, U> {}'); |
| 949 } | 950 } |
| 950 | 951 |
| 951 test_classes() { | 952 test_classes() { |
| 952 checkLibrary('class C {} class D {}'); | 953 checkLibrary('class C {} class D {}'); |
| 953 } | 954 } |
| 954 | 955 |
| 956 test_const_topLevel_binary() { |
| 957 shouldCompareConstValues = true; |
| 958 checkLibrary(r''' |
| 959 const vEqual = 1 == 2; |
| 960 const vAnd = true && false; |
| 961 const vOr = false || true; |
| 962 const vBitXor = 1 ^ 2; |
| 963 const vBitAnd = 1 & 2; |
| 964 const vBitOr = 1 | 2; |
| 965 const vBitShiftLeft = 1 << 2; |
| 966 const vBitShiftRight = 1 >> 2; |
| 967 const vAdd = 1 + 2; |
| 968 const vSubtract = 1 - 2; |
| 969 const vMiltiply = 1 * 2; |
| 970 const vDivide = 1 / 2; |
| 971 const vFloorDivide = 1 ~/ 2; |
| 972 const vModulo = 1 % 2; |
| 973 const vGreater = 1 > 2; |
| 974 const vGreaterEqual = 1 >= 2; |
| 975 const vLess = 1 < 2; |
| 976 const vLessEqual = 1 <= 2; |
| 977 '''); |
| 978 } |
| 979 |
| 980 test_const_topLevel_conditional() { |
| 981 shouldCompareConstValues = true; |
| 982 checkLibrary(r''' |
| 983 const vConditional = (1 == 2) ? 11 : 22; |
| 984 '''); |
| 985 } |
| 986 |
| 987 test_const_topLevel_identical() { |
| 988 shouldCompareConstValues = true; |
| 989 checkLibrary(r''' |
| 990 const vIdentical = (1 == 2) ? 11 : 22; |
| 991 '''); |
| 992 } |
| 993 |
| 955 test_const_topLevel_literal() { | 994 test_const_topLevel_literal() { |
| 956 shouldCompareConstValues = true; | 995 shouldCompareConstValues = true; |
| 957 checkLibrary(r''' | 996 checkLibrary(r''' |
| 958 const vNull = null; | 997 const vNull = null; |
| 959 const vBoolFalse = false; | 998 const vBoolFalse = false; |
| 960 const vBoolTrue = true; | 999 const vBoolTrue = true; |
| 961 const vInt = 1; | 1000 const vInt = 1; |
| 1001 const vIntLong = 0x9876543210987654321; |
| 962 const vDouble = 2.3; | 1002 const vDouble = 2.3; |
| 963 const vString = 'abc'; | 1003 const vString = 'abc'; |
| 964 const vStringConcat = 'aaa' 'bbb'; | 1004 const vStringConcat = 'aaa' 'bbb'; |
| 965 const vStringInterpolation = 'aaa ${true} ${42} bbb'; | 1005 const vStringInterpolation = 'aaa ${true} ${42} bbb'; |
| 1006 const vSymbol = #aaa.bbb.ccc; |
| 966 '''); | 1007 '''); |
| 967 } | 1008 } |
| 968 | 1009 |
| 1010 test_const_topLevel_unary() { |
| 1011 shouldCompareConstValues = true; |
| 1012 checkLibrary(r''' |
| 1013 const vNotEqual = 1 != 2; |
| 1014 const vNot = !true; |
| 1015 const vNegate = -1; |
| 1016 const vComplement = ~1; |
| 1017 '''); |
| 1018 } |
| 1019 |
| 969 test_constructor_documented() { | 1020 test_constructor_documented() { |
| 970 checkLibrary(''' | 1021 checkLibrary(''' |
| 971 class C { | 1022 class C { |
| 972 /** | 1023 /** |
| 973 * Docs | 1024 * Docs |
| 974 */ | 1025 */ |
| 975 C(); | 1026 C(); |
| 976 }'''); | 1027 }'''); |
| 977 } | 1028 } |
| 978 | 1029 |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 fail('Unexpectedly tried to get unlinked summary for $uri'); | 1957 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 1907 } | 1958 } |
| 1908 return serializedUnit; | 1959 return serializedUnit; |
| 1909 } | 1960 } |
| 1910 | 1961 |
| 1911 @override | 1962 @override |
| 1912 bool hasLibrarySummary(String uri) { | 1963 bool hasLibrarySummary(String uri) { |
| 1913 return true; | 1964 return true; |
| 1914 } | 1965 } |
| 1915 } | 1966 } |
| OLD | NEW |