blob: 29040d213d5edadbe25b09a6ca81431685b73105 [file] [log] [blame]
// Copyright (c) 2017, 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:analyzer/src/dart/error/syntactic_errors.dart';
import 'partial_code_support.dart';
main() {
new WhileStatementTest().buildAll();
}
class WhileStatementTest extends PartialCodeTest {
buildAll() {
buildTests(
'while_statement',
<TestDescriptor>[
new TestDescriptor(
'keyword',
'while',
[
ParserErrorCode.EXPECTED_TOKEN,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN
],
"while (_s_)",
allFailing: true,
expectedErrorsInValidCode: [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN
],
),
new TestDescriptor(
'leftParen',
'while (',
[ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN],
"while (_s_)",
allFailing: true,
expectedErrorsInValidCode: [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN
],
),
new TestDescriptor(
'condition',
'while (a',
[ParserErrorCode.EXPECTED_TOKEN],
"while (a)",
allFailing: true,
expectedErrorsInValidCode: [
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN
],
),
],
[],
head: 'f() { ',
tail: ' }',
);
buildTests(
'while_statement',
<TestDescriptor>[
new TestDescriptor(
'keyword',
'while',
[
ParserErrorCode.EXPECTED_TOKEN,
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN
],
"while (_s_)",
failing: ['break', 'continue'],
),
new TestDescriptor(
'leftParen',
'while (',
[ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN],
"while (_s_)",
allFailing: true,
),
new TestDescriptor(
'condition',
'while (a',
[ParserErrorCode.EXPECTED_TOKEN],
"while (a)",
allFailing: true,
),
],
PartialCodeTest.statementSuffixes,
head: 'f() { ',
includeEof: false,
tail: ' }',
);
}
}