dart-sdk/tests/dartdevc_2/assertion_failure_message_test.dart
Joshua Litt d14ab0779a [dartdevc] Migrate tests/compiler/dartdevc_native to tests/dartdevc_2.
Change-Id: I9c486f29f3bcf8a6ecf481eb25ea61d0468049b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150667
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-06-17 18:14:00 +00:00

32 lines
1.1 KiB
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.6
import "utils.dart";
void main() {
try {
assert(false, "failure message");
} on AssertionError catch (error) {
var message = error.toString();
expectStringContains('Assertion failed:', message);
expectStringContains('assertion_failure_message_test.dart:11:12', message);
expectStringContains('false', message);
expectStringContains('failure message', message);
}
// 失 All offsets and source code extractions should still be correct after
// non-UTF8 characters. See: https://github.com/dart-lang/sdk/issues/39271
try {
assert(false, "after a non-UTF8 character");
} on AssertionError catch (error) {
var message = error.toString();
expectStringContains('Assertion failed:', message);
expectStringContains('assertion_failure_message_test.dart:23:12', message);
expectStringContains('false', message);
expectStringContains('after a non-UTF8 character', message);
}
}