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

Side by Side Diff: test/equality_test.dart

Issue 1715553002: Define equality for boolean selectors. (Closed) Base URL: git@github.com:dart-lang/boolean_selector@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:test/test.dart';
6
7 import 'package:boolean_selector/boolean_selector.dart';
8
9 void main() {
10 test("variable", () {
11 _expectEqualsSelf("foo");
12 });
13
14 test("not", () {
15 _expectEqualsSelf("!foo");
16 });
17
18 test("or", () {
19 _expectEqualsSelf("foo || bar");
20 });
21
22 test("and", () {
23 _expectEqualsSelf("foo && bar");
24 });
25
26 test("conditional", () {
27 _expectEqualsSelf("foo ? bar : baz");
28 });
29
30 test("all", () {
31 expect(BooleanSelector.all, equals(BooleanSelector.all));
32 });
33
34 test("none", () {
35 expect(BooleanSelector.none, equals(BooleanSelector.none));
36 });
37
38 test("redundant parens don't matter", () {
39 expect(new BooleanSelector.parse("foo && (bar && baz)"),
40 equals(new BooleanSelector.parse("foo && (bar && baz)")));
41 });
42
43 test("meaningful parens do matter", () {
44 expect(new BooleanSelector.parse("(foo && bar) || baz"),
45 equals(new BooleanSelector.parse("foo && bar || baz")));
46 });
47 }
48
49 void _expectEqualsSelf(String selector) {
50 expect(new BooleanSelector.parse(selector),
51 equals(new BooleanSelector.parse(selector)));
52 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698