OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 package com.google.dart.compiler.parser; | 5 package com.google.dart.compiler.parser; |
6 | 6 |
7 import com.google.common.base.Joiner; | 7 import com.google.common.base.Joiner; |
8 import com.google.dart.compiler.DartCompilerListener; | 8 import com.google.dart.compiler.DartCompilerListener; |
9 import com.google.dart.compiler.DartSourceTest; | 9 import com.google.dart.compiler.DartSourceTest; |
10 import com.google.dart.compiler.ast.DartArrayLiteral; | 10 import com.google.dart.compiler.ast.DartArrayLiteral; |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 DartComment dartDoc = method.getDartDoc(); | 998 DartComment dartDoc = method.getDartDoc(); |
999 assertNotNull(dartDoc); | 999 assertNotNull(dartDoc); |
1000 String commentCode = getNodeSource(code, dartDoc); | 1000 String commentCode = getNodeSource(code, dartDoc); |
1001 assertTrue(commentCode.contains("DartDoc comment")); | 1001 assertTrue(commentCode.contains("DartDoc comment")); |
1002 assertTrue(commentCode.contains("@override")); | 1002 assertTrue(commentCode.contains("@override")); |
1003 } | 1003 } |
1004 } | 1004 } |
1005 } | 1005 } |
1006 } | 1006 } |
1007 | 1007 |
| 1008 public void test_operators_valid() throws Exception { |
| 1009 parseUnit("operators.dart", |
| 1010 Joiner.on("\n").join( |
| 1011 "class C {", |
| 1012 " operator <(v) {}", |
| 1013 " operator >(v) {}", |
| 1014 " operator <=(v) {}", |
| 1015 " operator >=(v) {}", |
| 1016 " operator ==(v) {}", |
| 1017 " operator -() {}", |
| 1018 " operator -(v) {}", |
| 1019 " operator +(v) {}", |
| 1020 " operator /(v) {}", |
| 1021 " operator ~/(v) {}", |
| 1022 " operator *(v) {}", |
| 1023 " operator %(v) {}", |
| 1024 " operator |(v) {}", |
| 1025 " operator ^(v) {}", |
| 1026 " operator &(v) {}", |
| 1027 " operator <<(v) {}", |
| 1028 " operator >>(v) {}", |
| 1029 " operator [](i) {}", |
| 1030 " operator []=(i, v) {}", |
| 1031 " operator ~() {}", |
| 1032 "}")); |
| 1033 } |
| 1034 |
1008 public void test_positionalDefaultValue() throws Exception { | 1035 public void test_positionalDefaultValue() throws Exception { |
1009 parseUnit("phony_test_abstract_var.dart", | 1036 parseUnit("phony_test_abstract_var.dart", |
1010 Joiner.on("\n").join( | 1037 Joiner.on("\n").join( |
1011 "method(arg=1) {", | 1038 "method(arg=1) {", |
1012 "}"), | 1039 "}"), |
1013 ParserErrorCode.DEFAULT_POSITIONAL_PARAMETER, 1, 8); | 1040 ParserErrorCode.DEFAULT_POSITIONAL_PARAMETER, 1, 8); |
1014 } | 1041 } |
1015 | 1042 |
1016 public void test_abstractInInterface() throws Exception { | 1043 public void test_abstractInInterface() throws Exception { |
1017 parseUnit("phony_test_abstract_in_interface.dart", | 1044 parseUnit("phony_test_abstract_in_interface.dart", |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 "typedef func(var arg());", | 1158 "typedef func(var arg());", |
1132 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_VAR, 1, 18); | 1159 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_VAR, 1, 18); |
1133 } | 1160 } |
1134 | 1161 |
1135 public void test_finalInFunctionType() throws Exception { | 1162 public void test_finalInFunctionType() throws Exception { |
1136 parseUnit("phony_var_in_function_type.dart", | 1163 parseUnit("phony_var_in_function_type.dart", |
1137 "typedef func(final arg());", | 1164 "typedef func(final arg());", |
1138 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_FINAL, 1, 20); | 1165 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_FINAL, 1, 20); |
1139 } | 1166 } |
1140 } | 1167 } |
OLD | NEW |