| 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'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'dart:async' show | 9 import 'dart:async' show |
| 10 Future; | 10 Future; |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 } | 989 } |
| 990 try { | 990 try { |
| 991 print(instance.x); | 991 print(instance.x); |
| 992 } catch (e) { | 992 } catch (e) { |
| 993 print('getter threw'); | 993 print('getter threw'); |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 """, | 996 """, |
| 997 const <String>['v2']), | 997 const <String>['v2']), |
| 998 ], | 998 ], |
| 999 |
| 1000 // Test removing a field from a class works. |
| 1001 // TODO(ahe): The emitter still see the field, and we need to ensure that |
| 1002 // old names aren't used again. |
| 1003 const <ProgramResult>[ |
| 1004 const ProgramResult( |
| 1005 r""" |
| 1006 class A { |
| 1007 var x; |
| 1008 } |
| 1009 |
| 1010 var instance; |
| 1011 |
| 1012 main() { |
| 1013 if (instance == null) { |
| 1014 instance = new A(); |
| 1015 } |
| 1016 try { |
| 1017 instance.x = 'v1'; |
| 1018 } catch(e) { |
| 1019 print('setter threw'); |
| 1020 } |
| 1021 try { |
| 1022 print(instance.x); |
| 1023 } catch (e) { |
| 1024 print('getter threw'); |
| 1025 } |
| 1026 } |
| 1027 """, |
| 1028 const <String>['v1']), |
| 1029 const ProgramResult( |
| 1030 r""" |
| 1031 class A { |
| 1032 } |
| 1033 |
| 1034 var instance; |
| 1035 |
| 1036 main() { |
| 1037 if (instance == null) { |
| 1038 instance = new A(); |
| 1039 } |
| 1040 try { |
| 1041 instance.x = 'v1'; |
| 1042 } catch(e) { |
| 1043 print('setter threw'); |
| 1044 } |
| 1045 try { |
| 1046 print(instance.x); |
| 1047 } catch (e) { |
| 1048 print('getter threw'); |
| 1049 } |
| 1050 } |
| 1051 """, |
| 1052 const <String>['setter threw', 'getter threw']), |
| 1053 ], |
| 999 ]; | 1054 ]; |
| 1000 | 1055 |
| 1001 void main() { | 1056 void main() { |
| 1002 listener.start(); | 1057 listener.start(); |
| 1003 | 1058 |
| 1004 document.head.append(lineNumberStyle()); | 1059 document.head.append(lineNumberStyle()); |
| 1005 | 1060 |
| 1006 return asyncTest(() => Future.forEach(tests, compileAndRun)); | 1061 return asyncTest(() => Future.forEach(tests, compileAndRun)); |
| 1007 } | 1062 } |
| 1008 | 1063 |
| 1009 int testCount = 1; | 1064 int testCount = 1; |
| 1010 | 1065 |
| 1011 Future compileAndRun(List<ProgramResult> programs) { | 1066 Future compileAndRun(List<ProgramResult> programs) { |
| 1012 var status = new DivElement(); | 1067 var status = new DivElement(); |
| 1013 document.body.append(status); | 1068 document.body.append(status); |
| 1014 | 1069 |
| 1015 IFrameElement iframe = | 1070 IFrameElement iframe = |
| 1016 appendIFrame( | 1071 appendIFrame( |
| 1017 '/root_dart/tests/try/web/incremental_compilation_update.html', | 1072 '/root_dart/tests/try/web/incremental_compilation_update.html', |
| 1018 document.body) | 1073 document.body) |
| 1019 ..style.width = '100%' | 1074 ..style.width = '100%' |
| 1020 ..style.height = '600px'; | 1075 ..style.height = '600px'; |
| 1021 | 1076 |
| 1022 return listener.expect('iframe-ready').then((_) { | 1077 return listener.expect('iframe-ready').then((_) { |
| 1023 ProgramResult program = programs.first; | 1078 ProgramResult program = programs.first; |
| 1024 | 1079 |
| 1025 | |
| 1026 status.append( | 1080 status.append( |
| 1027 new HeadingElement.h2() | 1081 new HeadingElement.h2() |
| 1028 ..appendText("Full program #${testCount++}:")); | 1082 ..appendText("Full program #${testCount++}:")); |
| 1029 status.append(numberedLines(program.code)); | 1083 status.append(numberedLines(program.code)); |
| 1030 | 1084 |
| 1031 status.style.color = 'orange'; | 1085 status.style.color = 'orange'; |
| 1032 WebCompilerTestCase test = new WebCompilerTestCase(program.code); | 1086 WebCompilerTestCase test = new WebCompilerTestCase(program.code); |
| 1033 return test.run().then((String jsCode) { | 1087 return test.run().then((String jsCode) { |
| 1034 status.style.color = 'red'; | 1088 status.style.color = 'red'; |
| 1035 var objectUrl = | 1089 var objectUrl = |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 position: absolute; | 1173 position: absolute; |
| 1120 left: 0px; | 1174 left: 0px; |
| 1121 width: 3em; | 1175 width: 3em; |
| 1122 text-align: right; | 1176 text-align: right; |
| 1123 background-color: lightgoldenrodyellow; | 1177 background-color: lightgoldenrodyellow; |
| 1124 } | 1178 } |
| 1125 '''); | 1179 '''); |
| 1126 style.type = 'text/css'; | 1180 style.type = 'text/css'; |
| 1127 return style; | 1181 return style; |
| 1128 } | 1182 } |
| OLD | NEW |