Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Side by Side Diff: pkg/analyzer/test/generated/all_the_rest.dart

Issue 689173004: Properly implement identical() test in analyzer constant evaluation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | tests/language/identical_const_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 5376 matching lines...) Expand 10 before | Expand all | Expand 10 after
5387 } 5387 }
5388 5388
5389 void test_hasExactValue_string_known() { 5389 void test_hasExactValue_string_known() {
5390 expect(_stringValue("twenty-three").hasExactValue, isTrue); 5390 expect(_stringValue("twenty-three").hasExactValue, isTrue);
5391 } 5391 }
5392 5392
5393 void test_hasExactValue_string_unknown() { 5393 void test_hasExactValue_string_unknown() {
5394 expect(_stringValue(null).hasExactValue, isTrue); 5394 expect(_stringValue(null).hasExactValue, isTrue);
5395 } 5395 }
5396 5396
5397 void test_identical_bool_false() {
5398 _assertIdentical(_boolValue(false), _boolValue(false), _boolValue(true));
5399 }
5400
5401 void test_identical_bool_true() {
5402 _assertIdentical(_boolValue(true), _boolValue(true), _boolValue(true));
5403 }
5404
5405 void test_identical_bool_unknown() {
5406 _assertIdentical(_boolValue(null), _boolValue(null), _boolValue(false));
5407 }
5408
5409 void test_identical_double_false() {
5410 _assertIdentical(_boolValue(false), _doubleValue(2.0), _doubleValue(4.0));
5411 }
5412
5413 void test_identical_double_true() {
5414 _assertIdentical(_boolValue(true), _doubleValue(2.0), _doubleValue(2.0));
5415 }
5416
5417 void test_identical_double_unknown() {
5418 _assertIdentical(_boolValue(null), _doubleValue(1.0), _doubleValue(null));
5419 }
5420
5421 void test_identical_int_false() {
5422 _assertIdentical(_boolValue(false), _intValue(-5), _intValue(5));
5423 }
5424
5425 void test_identical_int_true() {
5426 _assertIdentical(_boolValue(true), _intValue(5), _intValue(5));
5427 }
5428
5429 void test_identical_int_unknown() {
5430 _assertIdentical(_boolValue(null), _intValue(null), _intValue(3));
5431 }
5432
5433 void test_identical_list_empty() {
5434 _assertIdentical(_boolValue(true), _listValue([]), _listValue([]));
5435 }
5436
5437 void test_identical_list_false() {
5438 _assertIdentical(_boolValue(false), _listValue([]),
5439 _listValue([_intValue(3)]));
5440 }
5441
5442 void test_identical_map_empty() {
5443 _assertIdentical(_boolValue(true), _mapValue([]), _mapValue([]));
5444 }
5445
5446 void test_identical_map_false() {
5447 _assertIdentical(_boolValue(false), _mapValue([]),
5448 _mapValue([_intValue(1), _intValue(2)]));
5449 }
5450
5451 void test_identical_null() {
5452 _assertIdentical(_boolValue(true), _nullValue(), _nullValue());
5453 }
5454
5455 void test_identical_string_false() {
5456 _assertIdentical(
5457 _boolValue(false),
5458 _stringValue("abc"),
5459 _stringValue("def"));
5460 }
5461
5462 void test_identical_string_true() {
5463 _assertIdentical(
5464 _boolValue(true),
5465 _stringValue("abc"),
5466 _stringValue("abc"));
5467 }
5468
5469 void test_identical_string_unknown() {
5470 _assertIdentical(
5471 _boolValue(null),
5472 _stringValue(null),
5473 _stringValue("def"));
5474 }
5475
5397 void test_integerDivide_knownDouble_knownDouble() { 5476 void test_integerDivide_knownDouble_knownDouble() {
5398 _assertIntegerDivide(_intValue(3), _doubleValue(6.0), _doubleValue(2.0)); 5477 _assertIntegerDivide(_intValue(3), _doubleValue(6.0), _doubleValue(2.0));
5399 } 5478 }
5400 5479
5401 void test_integerDivide_knownDouble_knownInt() { 5480 void test_integerDivide_knownDouble_knownInt() {
5402 _assertIntegerDivide(_intValue(3), _doubleValue(6.0), _intValue(2)); 5481 _assertIntegerDivide(_intValue(3), _doubleValue(6.0), _intValue(2));
5403 } 5482 }
5404 5483
5405 void test_integerDivide_knownDouble_unknownDouble() { 5484 void test_integerDivide_knownDouble_unknownDouble() {
5406 _assertIntegerDivide( 5485 _assertIntegerDivide(
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
6434 } on EvaluationException catch (exception) { 6513 } on EvaluationException catch (exception) {
6435 } 6514 }
6436 } else { 6515 } else {
6437 DartObjectImpl result = 6516 DartObjectImpl result =
6438 leftOperand.greaterThanOrEqual(_typeProvider, rightOperand); 6517 leftOperand.greaterThanOrEqual(_typeProvider, rightOperand);
6439 expect(result, isNotNull); 6518 expect(result, isNotNull);
6440 expect(result, expected); 6519 expect(result, expected);
6441 } 6520 }
6442 } 6521 }
6443 6522
6523 /**
6524 * Assert that the result of comparing the left and right operands using
6525 * identical() is the expected value.
6526 *
6527 * @param expected the expected result of the operation
6528 * @param leftOperand the left operand to the operation
6529 * @param rightOperand the left operand to the operation
6530 */
6531 void _assertIdentical(DartObjectImpl expected, DartObjectImpl leftOperand,
6532 DartObjectImpl rightOperand) {
6533 DartObjectImpl result =
6534 leftOperand.isIdentical(_typeProvider, rightOperand);
6535 expect(result, isNotNull);
6536 expect(result, expected);
6537 }
6538
6444 void _assertInstanceOfObjectArray(Object result) { 6539 void _assertInstanceOfObjectArray(Object result) {
6445 // TODO(scheglov) implement 6540 // TODO(scheglov) implement
6446 } 6541 }
6447 6542
6448 /** 6543 /**
6449 * Assert that the result of dividing the left and right operands as integers is the expected 6544 * Assert that the result of dividing the left and right operands as integers is the expected
6450 * value, or that the operation throws an exception if the expected value is ` null`. 6545 * value, or that the operation throws an exception if the expected value is ` null`.
6451 * 6546 *
6452 * @param expected the expected result of the operation 6547 * @param expected the expected result of the operation
6453 * @param leftOperand the left operand to the operation 6548 * @param leftOperand the left operand to the operation
(...skipping 4514 matching lines...) Expand 10 before | Expand all | Expand 10 after
10968 Source scriptSource = externalScript.scriptSource; 11063 Source scriptSource = externalScript.scriptSource;
10969 if (_expectedExternalScriptName == null) { 11064 if (_expectedExternalScriptName == null) {
10970 expect(scriptSource, isNull, reason: "script $scriptIndex"); 11065 expect(scriptSource, isNull, reason: "script $scriptIndex");
10971 } else { 11066 } else {
10972 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 11067 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
10973 String actualExternalScriptName = scriptSource.shortName; 11068 String actualExternalScriptName = scriptSource.shortName;
10974 expect(actualExternalScriptName, _expectedExternalScriptName, reason: "scr ipt $scriptIndex"); 11069 expect(actualExternalScriptName, _expectedExternalScriptName, reason: "scr ipt $scriptIndex");
10975 } 11070 }
10976 } 11071 }
10977 } 11072 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | tests/language/identical_const_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698