dart-sdk/pkg/front_end/test/severity_index_test.dart
Johnni Winther c8595fdee2 [cfe] Migrate (more) CFE tests (part 4)
Change-Id: I47741cb3dc5714f765d9b45698c2ae05dbf5349a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220322
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-16 12:13:14 +00:00

24 lines
925 B
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.
import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;
/// Test that Severity has the expected indexes. Note that this is important
/// and shouldn't be changed lightly because we use it in serialization!
void main() {
expect(Severity.context.index, 0);
expect(Severity.error.index, 1);
expect(Severity.internalProblem.index, 3);
expect(Severity.warning.index, 4);
expect(Severity.values[0], Severity.context);
expect(Severity.values[1], Severity.error);
expect(Severity.values[3], Severity.internalProblem);
expect(Severity.values[4], Severity.warning);
}
void expect(Object actual, Object expect) {
if (expect != actual) throw "Expected $expect got $actual";
}