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 engine.all_the_rest_test; | 5 library engine.all_the_rest_test; |
6 | 6 |
7 import 'package:analyzer/file_system/physical_file_system.dart'; | 7 import 'package:analyzer/file_system/physical_file_system.dart'; |
8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
9 import 'package:analyzer/src/generated/constant.dart'; | 9 import 'package:analyzer/src/generated/constant.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 3131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3142 | 3142 |
3143 void test_hasKnownValue_bool_false() { | 3143 void test_hasKnownValue_bool_false() { |
3144 expect(_boolValue(false).hasKnownValue, isTrue); | 3144 expect(_boolValue(false).hasKnownValue, isTrue); |
3145 } | 3145 } |
3146 | 3146 |
3147 void test_hasKnownValue_bool_true() { | 3147 void test_hasKnownValue_bool_true() { |
3148 expect(_boolValue(true).hasKnownValue, isTrue); | 3148 expect(_boolValue(true).hasKnownValue, isTrue); |
3149 } | 3149 } |
3150 | 3150 |
3151 void test_hasKnownValue_bool_unknown() { | 3151 void test_hasKnownValue_bool_unknown() { |
3152 expect(_boolValue(null).hasKnownValue, isTrue); | 3152 expect(_boolValue(null).hasKnownValue, isFalse); |
3153 } | 3153 } |
3154 | 3154 |
3155 void test_hasKnownValue_double_known() { | 3155 void test_hasKnownValue_double_known() { |
3156 expect(_doubleValue(2.3).hasKnownValue, isTrue); | 3156 expect(_doubleValue(2.3).hasKnownValue, isTrue); |
3157 } | 3157 } |
3158 | 3158 |
3159 void test_hasKnownValue_double_unknown() { | 3159 void test_hasKnownValue_double_unknown() { |
3160 expect(_doubleValue(null).hasKnownValue, isTrue); | 3160 expect(_doubleValue(null).hasKnownValue, isFalse); |
3161 } | 3161 } |
3162 | 3162 |
3163 void test_hasKnownValue_dynamic() { | 3163 void test_hasKnownValue_dynamic() { |
3164 expect(_dynamicValue().hasKnownValue, isFalse); | 3164 expect(_dynamicValue().hasKnownValue, isTrue); |
3165 } | 3165 } |
3166 | 3166 |
3167 void test_hasKnownValue_int_known() { | 3167 void test_hasKnownValue_int_known() { |
3168 expect(_intValue(23).hasKnownValue, isTrue); | 3168 expect(_intValue(23).hasKnownValue, isTrue); |
3169 } | 3169 } |
3170 | 3170 |
3171 void test_hasKnownValue_int_unknown() { | 3171 void test_hasKnownValue_int_unknown() { |
3172 expect(_intValue(null).hasKnownValue, isTrue); | 3172 expect(_intValue(null).hasKnownValue, isFalse); |
3173 } | 3173 } |
3174 | 3174 |
3175 void test_hasKnownValue_list_empty() { | 3175 void test_hasKnownValue_list_empty() { |
3176 expect(_listValue().hasKnownValue, isTrue); | 3176 expect(_listValue().hasKnownValue, isTrue); |
3177 } | 3177 } |
3178 | 3178 |
3179 void test_hasKnownValue_list_invalid() { | 3179 void test_hasKnownValue_list_invalid() { |
3180 expect(_dynamicValue().hasKnownValue, isFalse); | 3180 expect(_dynamicValue().hasKnownValue, isTrue); |
3181 } | 3181 } |
3182 | 3182 |
3183 void test_hasKnownValue_list_valid() { | 3183 void test_hasKnownValue_list_valid() { |
3184 expect(_listValue([_intValue(23)]).hasKnownValue, isTrue); | 3184 expect(_listValue([_intValue(23)]).hasKnownValue, isTrue); |
3185 } | 3185 } |
3186 | 3186 |
3187 void test_hasKnownValue_map_empty() { | 3187 void test_hasKnownValue_map_empty() { |
3188 expect(_mapValue().hasKnownValue, isTrue); | 3188 expect(_mapValue().hasKnownValue, isTrue); |
3189 } | 3189 } |
3190 | 3190 |
3191 void test_hasKnownValue_map_invalidKey() { | 3191 void test_hasKnownValue_map_invalidKey() { |
3192 expect(_mapValue([_dynamicValue(), _stringValue("value")]).hasKnownValue, | 3192 expect(_mapValue([_dynamicValue(), _stringValue("value")]).hasKnownValue, |
3193 isFalse); | 3193 isTrue); |
3194 } | 3194 } |
3195 | 3195 |
3196 void test_hasKnownValue_map_invalidValue() { | 3196 void test_hasKnownValue_map_invalidValue() { |
3197 expect(_mapValue([_stringValue("key"), _dynamicValue()]).hasKnownValue, | 3197 expect(_mapValue([_stringValue("key"), _dynamicValue()]).hasKnownValue, |
3198 isFalse); | 3198 isTrue); |
3199 } | 3199 } |
3200 | 3200 |
3201 void test_hasKnownValue_map_valid() { | 3201 void test_hasKnownValue_map_valid() { |
3202 expect( | 3202 expect( |
3203 _mapValue([_stringValue("key"), _stringValue("value")]).hasKnownValue, | 3203 _mapValue([_stringValue("key"), _stringValue("value")]).hasKnownValue, |
3204 isTrue); | 3204 isTrue); |
3205 } | 3205 } |
3206 | 3206 |
3207 void test_hasKnownValue_null() { | 3207 void test_hasKnownValue_null() { |
3208 expect(_nullValue().hasKnownValue, isTrue); | 3208 expect(_nullValue().hasKnownValue, isTrue); |
3209 } | 3209 } |
3210 | 3210 |
3211 void test_hasKnownValue_num() { | 3211 void test_hasKnownValue_num() { |
3212 expect(_numValue().hasKnownValue, isFalse); | 3212 expect(_numValue().hasKnownValue, isFalse); |
3213 } | 3213 } |
3214 | 3214 |
3215 void test_hasKnownValue_string_known() { | 3215 void test_hasKnownValue_string_known() { |
3216 expect(_stringValue("twenty-three").hasKnownValue, isTrue); | 3216 expect(_stringValue("twenty-three").hasKnownValue, isTrue); |
3217 } | 3217 } |
3218 | 3218 |
3219 void test_hasKnownValue_string_unknown() { | 3219 void test_hasKnownValue_string_unknown() { |
3220 expect(_stringValue(null).hasKnownValue, isTrue); | 3220 expect(_stringValue(null).hasKnownValue, isFalse); |
3221 } | 3221 } |
3222 | 3222 |
3223 void test_identical_bool_false() { | 3223 void test_identical_bool_false() { |
3224 _assertIdentical(_boolValue(false), _boolValue(false), _boolValue(true)); | 3224 _assertIdentical(_boolValue(false), _boolValue(false), _boolValue(true)); |
3225 } | 3225 } |
3226 | 3226 |
3227 void test_identical_bool_true() { | 3227 void test_identical_bool_true() { |
3228 _assertIdentical(_boolValue(true), _boolValue(true), _boolValue(true)); | 3228 _assertIdentical(_boolValue(true), _boolValue(true), _boolValue(true)); |
3229 } | 3229 } |
3230 | 3230 |
(...skipping 6160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9391 if (_expectedExternalScriptName == null) { | 9391 if (_expectedExternalScriptName == null) { |
9392 expect(scriptSource, isNull, reason: "script $scriptIndex"); | 9392 expect(scriptSource, isNull, reason: "script $scriptIndex"); |
9393 } else { | 9393 } else { |
9394 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 9394 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
9395 String actualExternalScriptName = scriptSource.shortName; | 9395 String actualExternalScriptName = scriptSource.shortName; |
9396 expect(actualExternalScriptName, _expectedExternalScriptName, | 9396 expect(actualExternalScriptName, _expectedExternalScriptName, |
9397 reason: "script $scriptIndex"); | 9397 reason: "script $scriptIndex"); |
9398 } | 9398 } |
9399 } | 9399 } |
9400 } | 9400 } |
OLD | NEW |