[test] Use Uris in place of Strings in test

Provides consistent behavior for identical and equals across all
backends. The test was failing on JavaScript backends because 
Strings that are equal are also identical.

Change-Id: I85929f37746d8f7e192410e3d2f6530ce05176c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343860
Reviewed-by: Nate Bosch <nbosch@google.com>
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
This commit is contained in:
Nicholas Shahan 2023-12-28 03:19:30 +00:00 committed by Commit Queue
parent 6a9b550f35
commit f860d84ad7

View file

@ -39,15 +39,15 @@ class ExpectTest {
throw "Expect.isFalse did not fail";
}
static testIdentical(a) {
var ab = a + "B";
static testIdentical(uriA) {
var uriB = Uri.parse('$uriA');
try {
Expect.identical("AB", ab);
Expect.identical(uriA, uriB);
} on ExpectException catch (msg) {
print(msg);
return;
}
Expect.equals("AB", ab);
Expect.equals(uriA, uriB);
throw "Expect.identical did not fail";
}
@ -67,7 +67,7 @@ class ExpectTest {
testIsTrue(1);
testIsFalse(true);
testIsFalse(0);
testIdentical("A");
testIdentical(Uri.parse("A"));
testFail();
}
}