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

Unified Diff: tests/fletch_tests/sentence_tests.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 11 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
« no previous file with comments | « tests/fletch_tests/self_tests.dart ('k') | tests/fletch_tests/snapshot_stacktrace_tests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/fletch_tests/sentence_tests.dart
diff --git a/tests/fletch_tests/sentence_tests.dart b/tests/fletch_tests/sentence_tests.dart
deleted file mode 100644
index 11cbf332072ff818d20b483bc8970e30d90d7f1d..0000000000000000000000000000000000000000
--- a/tests/fletch_tests/sentence_tests.dart
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2015, the Dartino 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.md file.
-
-import 'dart:async' show
- Future;
-
-import 'package:fletchc/src/hub/sentence_parser.dart';
-
-import 'package:expect/expect.dart';
-
-Future main() {
- Sentence sentence;
-
- void checkAction(String name) {
- Expect.isNotNull(sentence.verb);
- Expect.stringEquals(name, sentence.verb.name);
- print("Action '$name' as expected.");
- }
-
- void checkTarget(TargetKind kind) {
- Expect.isNotNull(sentence.targets.single);
- Expect.equals(kind, sentence.targets.single.kind);
- print("Target '$kind' as expected.");
- }
-
- void checkNamedTarget(TargetKind kind, String name) {
- Expect.isNotNull(sentence.targets.single);
- NamedTarget namedTarget = sentence.targets.single;
- Expect.equals(kind, namedTarget.kind);
- Expect.stringEquals(name, namedTarget.name);
- print("NamedTarget '$kind $name' as expected.");
- }
-
- void checkNoTarget() {
- Expect.isTrue(sentence.targets.isEmpty);
- print("No target as expected.");
- }
-
- sentence = parseSentence([]);
- print(sentence);
- checkAction('help');
- Expect.isTrue(sentence.prepositions.isEmpty);
- checkNoTarget();
- Expect.isNull(sentence.trailing);
-
- sentence = parseSentence(['not_a_verb']);
- print(sentence);
- checkAction('not_a_verb');
- Expect.isTrue(sentence.prepositions.isEmpty);
- checkNoTarget();
- Expect.isNotNull(sentence.trailing);
- Expect.listEquals(['not_a_verb'], sentence.trailing);
-
- sentence = parseSentence(['create', 'session', 'fisk']);
- print(sentence);
- checkAction('create');
- Expect.isTrue(sentence.prepositions.isEmpty);
- checkNamedTarget(TargetKind.SESSION, 'fisk');
- Expect.isNull(sentence.trailing);
-
- void checkCreateFooInFisk() {
- Expect.isNotNull(sentence.verb);
- Expect.stringEquals('create', sentence.verb.name);
- Preposition preposition = sentence.prepositions.single;
- Expect.isNotNull(preposition);
- Expect.equals(PrepositionKind.IN, preposition.kind);
- NamedTarget namedTarget = preposition.target;
- Expect.isNotNull(namedTarget);
- Expect.equals(TargetKind.SESSION, namedTarget.kind);
- Expect.stringEquals('fisk', namedTarget.name);
- checkNamedTarget(TargetKind.CLASS, 'Foo');
- Expect.isNull(sentence.trailing);
- }
- sentence = parseSentence(['create', 'in', 'session', 'fisk', 'class', 'Foo']);
- print(sentence);
- checkCreateFooInFisk();
-
- sentence = parseSentence(['create', 'class', 'Foo', 'in', 'session', 'fisk']);
- print(sentence);
- checkCreateFooInFisk();
-
- sentence = parseSentence(['create', 'in', 'fisk']);
- print(sentence);
- checkAction('create');
- Expect.isNotNull(sentence.prepositions.single);
- Expect.equals(PrepositionKind.IN, sentence.prepositions.single.kind);
- Expect.isTrue(sentence.prepositions.single.target is ErrorTarget);
- checkNoTarget();
- Expect.isNull(sentence.trailing);
-
- sentence = parseSentence(['create', 'in', 'fisk', 'fisk']);
- print(sentence);
- checkAction('create');
- Expect.isNotNull(sentence.prepositions.single);
- Expect.equals(PrepositionKind.IN, sentence.prepositions.single.kind);
- Expect.isTrue(sentence.prepositions.single.target is ErrorTarget);
- checkNoTarget();
- Expect.isNotNull(sentence.trailing);
- Expect.listEquals(['fisk'], sentence.trailing);
-
- sentence = parseSentence(['help', 'all']);
- print(sentence);
- checkAction('help');
- Expect.isTrue(sentence.prepositions.isEmpty);
- checkTarget(TargetKind.ALL);
- Expect.isNull(sentence.trailing);
-
- return new Future.value();
-}
« no previous file with comments | « tests/fletch_tests/self_tests.dart ('k') | tests/fletch_tests/snapshot_stacktrace_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698