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 trydart.incremental_compilation_update_test; | 5 library trydart.incremental_compilation_update_test; |
6 | 6 |
7 import 'dart:html' hide | 7 import 'dart:html' hide |
8 Element; | 8 Element; |
9 | 9 |
10 import 'dart:async' show | 10 import 'dart:async' show |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 print(instance.x); | 1076 print(instance.x); |
1077 } catch (e) { | 1077 } catch (e) { |
1078 print('getter threw'); | 1078 print('getter threw'); |
1079 } | 1079 } |
1080 } | 1080 } |
1081 """, | 1081 """, |
1082 const <String>['setter threw', 'getter threw']), | 1082 const <String>['setter threw', 'getter threw']), |
1083 ], | 1083 ], |
1084 | 1084 |
1085 // Test that named arguments can be called. | 1085 // Test that named arguments can be called. |
1086 // TODO(ahe): This test doesn't pass yet, see expectation below. | |
1087 const <ProgramResult>[ | 1086 const <ProgramResult>[ |
1088 const ProgramResult( | 1087 const ProgramResult( |
1089 r""" | 1088 r""" |
1090 class C { | 1089 class C { |
1091 foo({a, named: 'v1', x}) { | 1090 foo({a, named: 'v1', x}) { |
1092 print(named); | 1091 print(named); |
1093 } | 1092 } |
1094 } | 1093 } |
1095 | 1094 |
1096 var instance; | 1095 var instance; |
1097 | 1096 |
1098 main() { | 1097 main() { |
1099 if (instance == null) { | 1098 if (instance == null) { |
1100 print('instance is null'); | 1099 print('instance is null'); |
1101 instance = new C(); | 1100 instance = new C(); |
1102 } | 1101 } |
1103 try { | 1102 instance.foo(); |
1104 instance.foo(); | |
1105 } catch (e) { | |
1106 // TODO(ahe): This try/catch shouldn't be necessary. | |
1107 print('threw'); | |
1108 } | |
1109 } | 1103 } |
1110 """, | 1104 """, |
1111 const <String>['instance is null', 'v1']), | 1105 const <String>['instance is null', 'v1']), |
1112 const ProgramResult( | 1106 const ProgramResult( |
1113 r""" | 1107 r""" |
1114 class C { | 1108 class C { |
1115 foo({a, named: 'v1', x}) { | 1109 foo({a, named: 'v1', x}) { |
1116 print(named); | 1110 print(named); |
1117 } | 1111 } |
1118 } | 1112 } |
1119 | 1113 |
1120 var instance; | 1114 var instance; |
1121 | 1115 |
1122 main() { | 1116 main() { |
1123 if (instance == null) { | 1117 if (instance == null) { |
1124 print('instance is null'); | 1118 print('instance is null'); |
1125 instance = new C(); | 1119 instance = new C(); |
1126 } | 1120 } |
1127 try { | 1121 instance.foo(named: 'v2'); |
1128 instance.foo(named: 'v2'); | |
1129 } catch (e) { | |
1130 // TODO(ahe): This try/catch shouldn't be necessary. | |
1131 print('threw'); | |
1132 } | |
1133 } | 1122 } |
1134 """, | 1123 """, |
1135 const <String>['threw']), // TODO(ahe): Expect 'v2'. | 1124 const <String>['v2']), |
1136 ], | 1125 ], |
1137 | 1126 |
1138 // Test than named arguments can be called. | 1127 // Test than named arguments can be called. |
1139 // TODO(ahe): This test doesn't pass yet, see expectation below. | |
1140 const <ProgramResult>[ | 1128 const <ProgramResult>[ |
1141 const ProgramResult( | 1129 const ProgramResult( |
1142 r""" | 1130 r""" |
1143 class C { | 1131 class C { |
1144 foo({a, named: 'v2', x}) { | 1132 foo({a, named: 'v2', x}) { |
1145 print(named); | 1133 print(named); |
1146 } | 1134 } |
1147 } | 1135 } |
1148 | 1136 |
1149 var instance; | 1137 var instance; |
1150 | 1138 |
1151 main() { | 1139 main() { |
1152 if (instance == null) { | 1140 if (instance == null) { |
1153 print('instance is null'); | 1141 print('instance is null'); |
1154 instance = new C(); | 1142 instance = new C(); |
1155 } | 1143 } |
1156 try { | 1144 instance.foo(named: 'v1'); |
1157 instance.foo(named: 'v1'); | |
1158 } catch (e) { | |
1159 // TODO(ahe): This try/catch shouldn't be necessary. | |
1160 print('threw'); | |
1161 } | |
1162 } | 1145 } |
1163 """, | 1146 """, |
1164 const <String>['instance is null', 'v1']), | 1147 const <String>['instance is null', 'v1']), |
1165 const ProgramResult( | 1148 const ProgramResult( |
1166 r""" | 1149 r""" |
1167 class C { | 1150 class C { |
1168 foo({a, named: 'v2', x}) { | 1151 foo({a, named: 'v2', x}) { |
1169 print(named); | 1152 print(named); |
1170 } | 1153 } |
1171 } | 1154 } |
1172 | 1155 |
1173 var instance; | 1156 var instance; |
1174 | 1157 |
1175 main() { | 1158 main() { |
1176 if (instance == null) { | 1159 if (instance == null) { |
1177 print('instance is null'); | 1160 print('instance is null'); |
1178 instance = new C(); | 1161 instance = new C(); |
1179 } | 1162 } |
1180 try { | 1163 instance.foo(); |
1181 instance.foo(); | |
1182 } catch (e) { | |
1183 // TODO(ahe): This try/catch shouldn't be necessary. | |
1184 print('threw'); | |
1185 } | |
1186 } | 1164 } |
1187 """, | 1165 """, |
1188 const <String>['threw']), | 1166 const <String>['v2']), |
1189 ], | 1167 ], |
1190 | 1168 |
1191 // Test that an instance tear-off with named parameters can be called. | 1169 // Test that an instance tear-off with named parameters can be called. |
1192 // TODO(ahe): This test doesn't pass yet, see expectation below. | |
1193 const <ProgramResult>[ | 1170 const <ProgramResult>[ |
1194 const ProgramResult( | 1171 const ProgramResult( |
1195 r""" | 1172 r""" |
1196 class C { | 1173 class C { |
1197 foo({a, named: 'v1', x}) { | 1174 foo({a, named: 'v1', x}) { |
1198 print(named); | 1175 print(named); |
1199 } | 1176 } |
1200 } | 1177 } |
1201 | 1178 |
1202 var closure; | 1179 var closure; |
1203 | 1180 |
1204 main() { | 1181 main() { |
1205 if (closure == null) { | 1182 if (closure == null) { |
1206 print('closure is null'); | 1183 print('closure is null'); |
1207 closure = new C().foo; | 1184 closure = new C().foo; |
1208 } | 1185 } |
1209 try { | 1186 closure(); |
1210 closure(); | |
1211 } catch (e) { | |
1212 // TODO(ahe): This try/catch shouldn't be necessary. | |
1213 print('threw'); | |
1214 } | |
1215 } | 1187 } |
1216 """, | 1188 """, |
1217 const <String>['closure is null', 'v1']), | 1189 const <String>['closure is null', 'v1']), |
1218 const ProgramResult( | 1190 const ProgramResult( |
1219 r""" | 1191 r""" |
1220 class C { | 1192 class C { |
1221 foo({a, named: 'v1', x}) { | 1193 foo({a, named: 'v1', x}) { |
1222 print(named); | 1194 print(named); |
1223 } | 1195 } |
1224 } | 1196 } |
1225 | 1197 |
1226 var closure; | 1198 var closure; |
1227 | 1199 |
1228 main() { | 1200 main() { |
1229 if (closure == null) { | 1201 if (closure == null) { |
1230 print('closure is null'); | 1202 print('closure is null'); |
1231 closure = new C().foo; | 1203 closure = new C().foo; |
1232 } | 1204 } |
1233 try { | 1205 closure(named: 'v2'); |
1234 closure(named: 'v2'); | |
1235 } catch (e) { | |
1236 // TODO(ahe): This try/catch shouldn't be necessary. | |
1237 print('threw'); | |
1238 } | |
1239 } | 1206 } |
1240 """, | 1207 """, |
1241 const <String>['threw']), // TODO(ahe): Expect 'v2'. | 1208 const <String>['v2']), |
1242 ], | 1209 ], |
1243 | 1210 |
1244 /* | 1211 /* |
1245 // Test that a lazy static is supported. | 1212 // Test that a lazy static is supported. |
1246 // TODO(ahe): This test doesn't pass yet. | 1213 // TODO(ahe): This test doesn't pass yet. |
1247 const <ProgramResult>[ | 1214 const <ProgramResult>[ |
1248 const ProgramResult( | 1215 const ProgramResult( |
1249 r""" | 1216 r""" |
1250 var normal; | 1217 var normal; |
1251 | 1218 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 position: absolute; | 1489 position: absolute; |
1523 left: 0px; | 1490 left: 0px; |
1524 width: 3em; | 1491 width: 3em; |
1525 text-align: right; | 1492 text-align: right; |
1526 background-color: lightgoldenrodyellow; | 1493 background-color: lightgoldenrodyellow; |
1527 } | 1494 } |
1528 '''); | 1495 '''); |
1529 style.type = 'text/css'; | 1496 style.type = 'text/css'; |
1530 return style; | 1497 return style; |
1531 } | 1498 } |
OLD | NEW |