Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: pkg/args/test/parse_all_test.dart

Issue 260963007: Move allowTrailingOptions into ArgParser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/args/test/parse_all_test.dart
diff --git a/pkg/args/test/parse_all_test.dart b/pkg/args/test/parse_all_test.dart
deleted file mode 100644
index d404c2f906c209a824ede715d639cf515f871d91..0000000000000000000000000000000000000000
--- a/pkg/args/test/parse_all_test.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2013, 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.
-
-library parse_all_test;
-
-import 'package:unittest/unittest.dart';
-import 'package:args/args.dart';
-
-void main() {
- group('ArgParser.parse(allowTrailingOptions: true) '
- 'starting with a non-option', () {
- test('followed by flag', () {
- var parser = new ArgParser()..addFlag('flag');
- var args = ['A', '--flag'];
-
- var resultsAll = parser.parse(args, allowTrailingOptions: true);
- expect(resultsAll['flag'], isTrue);
- expect(resultsAll.rest, equals(['A']));
- });
-
- test('followed by option', () {
- var parser = new ArgParser()..addOption('opt');
- var args = ['A', '--opt'];
-
- expectThrows(parser, args);
- });
-
- test('followed by option and value', () {
- var parser = new ArgParser()..addOption('opt');
- var args = ['A', '--opt', 'V'];
-
- var resultsAll = parser.parse(args, allowTrailingOptions: true);
- expect(resultsAll['opt'], equals('V'));
- expect(resultsAll.rest, equals(['A']));
- });
-
- test('followed by unknown flag', () {
- var parser = new ArgParser();
- var args = ['A', '--xflag'];
-
- expectThrows(parser, args);
- });
-
- test('followed by unknown option and value', () {
- var parser = new ArgParser();
- var args = ['A', '--xopt', 'V'];
-
- expectThrows(parser, args);
- });
-
- test('followed by command', () {
- var parser = new ArgParser()..addCommand('com');
- var args = ['A', 'com'];
-
- expectThrows(parser, args);
- });
- });
-}
-
-void expectThrows(ArgParser parser, List<String> args) =>
- expect(() => parser.parse(args, allowTrailingOptions: true),
- throwsFormatException,
- reason: "with allowTrailingOptions: true");

Powered by Google App Engine
This is Rietveld 408576698