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

Unified Diff: pkg/polymer_expressions/test/eval_test.dart

Issue 23458017: Add null literals to polymer expressions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « pkg/polymer_expressions/lib/parser.dart ('k') | pkg/polymer_expressions/test/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer_expressions/test/eval_test.dart
diff --git a/pkg/polymer_expressions/test/eval_test.dart b/pkg/polymer_expressions/test/eval_test.dart
index b2d9123e75814df913d0fc7dd04bd88d93775ff0..cdb973c5c9ac23a92d4876b230616311111afbbb 100644
--- a/pkg/polymer_expressions/test/eval_test.dart
+++ b/pkg/polymer_expressions/test/eval_test.dart
@@ -47,6 +47,10 @@ main() {
expectEval('false', false);
});
+ test('should return a literal null', () {
+ expectEval('null', null);
+ });
+
test('should return a literal map', () {
expectEval('{"a": 1}', equals(new Map.from({'a': 1})));
expectEval('{"a": 1}', containsPair('a', 1));
@@ -70,6 +74,7 @@ main() {
expectEval('1 == 1', true);
expectEval('1 == 2', false);
+ expectEval('1 == null', false);
Chris Bracken 2013/09/03 21:55:39 != test for the truly paranoid?
expectEval('1 != 1', false);
expectEval('1 != 2', true);
@@ -162,6 +167,10 @@ main() {
});
test('should treat null as false', () {
+ expectEval('!null', true, null);
+ expectEval('true && null', false, null);
Jennifer Messerly 2013/09/03 21:47:24 ... you don't want 3-valued boolean logic here? ;)
justinfagnani 2013/09/03 21:54:36 don't tempt me!
+ expectEval('null || false', false, null);
+
expectEval('!a', true, null, {'a': null});
expectEval('a && b', false, null, {'a': null, 'b': true});
« no previous file with comments | « pkg/polymer_expressions/lib/parser.dart ('k') | pkg/polymer_expressions/test/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698