Files
sdk/pkg/front_end/test/severity_index_test.dart
T
Jens Johansen 014124e763 (Some) DiagnosticMessages can be serialized to/from json.
This is needed to serialize and deserialize problems to dill and
re-issuing problems as needed.

Change-Id: Id22d1c86f43b1b08c5e5a4d133869075e9b0c100
Reviewed-on: https://dart-review.googlesource.com/c/91743
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-01 11:07:27 +00:00

24 lines
907 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:front_end/src/fasta/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!
main() {
expect(Severity.context.index, 0);
expect(Severity.error.index, 1);
expect(Severity.internalProblem.index, 4);
expect(Severity.warning.index, 5);
expect(Severity.values[0], Severity.context);
expect(Severity.values[1], Severity.error);
expect(Severity.values[4], Severity.internalProblem);
expect(Severity.values[5], Severity.warning);
}
void expect(Object actual, Object expect) {
if (expect != actual) throw "Expected $expect got $actual";
}