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

Unified Diff: third_party/pkg/angular/bin/parser_generator_for_spec.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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: third_party/pkg/angular/bin/parser_generator_for_spec.dart
diff --git a/third_party/pkg/angular/bin/parser_generator_for_spec.dart b/third_party/pkg/angular/bin/parser_generator_for_spec.dart
new file mode 100644
index 0000000000000000000000000000000000000000..66ca7f01e008e6cd878f0caa9510a1f9d765c515
--- /dev/null
+++ b/third_party/pkg/angular/bin/parser_generator_for_spec.dart
@@ -0,0 +1,212 @@
+import 'dart:io';
+import 'package:di/di.dart';
+import 'package:di/dynamic_injector.dart';
+import 'package:angular/core/parser/parser_library.dart';
+import 'package:angular/tools/parser_generator/dart_code_gen.dart';
+import 'package:angular/tools/parser_generator/generator.dart';
+import 'package:angular/tools/parser_getter_setter/generator.dart';
+
+main(arguments) {
+ var isGetter = !arguments.isEmpty;
+
+ Module module = new Module()
+ ..type(ParserBackend, implementedBy: isGetter ? DartGetterSetterGen : DartCodeGen);
+
+ Injector injector = new DynamicInjector(modules: [module],
+ allowImplicitInjection: true);
+
+ // List generated using:
+ // node node_modules/karma/bin/karma run | grep -Eo ":XNAY:.*:XNAY:" | sed -e 's/:XNAY://g' | sed -e "s/^/'/" | sed -e "s/$/',/" | sort | uniq > missing_expressions
+ injector.get(isGetter ? ParserGetterSetter : ParserGenerator).generateParser([
+ "foo == 'bar' ||\nbaz",
+ "this['a'].b",
+ "const",
+ "null",
+ "[1, 2].length",
+ "doesNotExist",
+ "a.b.c",
+ "x.b.c",
+ "e1.b",
+ "o.f()",
+ "1", "-1", "+1",
+ "!true",
+ "3*4/2%5", "3+6-2",
+ "2<3", "2>3", "2<=2", "2>=2",
+ "2==3", "2!=3",
+ "true&&true", "true&&false",
+ "true||true", "true||false", "false||false",
+ "'str ' + 4", "4 + ' str'", "4 + 4", "4 + 4 + ' str'",
+ "'str ' + 4 + 4",
+ "a", "b.c" , "x.y.z",
+ 'ident.id(6)', 'ident.doubleId(4,5)',
+ "a.b.c.d.e.f.g.h.i.j.k.l.m.n",
+ 'b', 'a.x', 'a.b.c.d',
+ "(1+2)*3",
+ "a=12", "arr[c=1]", "x.y.z=123;",
+ "a=123; b=234",
+ "constN()",
+ "add(1,2)",
+ "getter()()",
+ "obj.elementAt(0)",
+ "[]",
+ "[1, 2]",
+ "[1][0]",
+ "[[1]][0][0]",
+ "[].length",
+ "{}",
+ "{a:'b'}",
+ "{'a':'b'}",
+ "{\"a\":'b'}",
+ "{false:'WC', true:'CC'}[false]",
+ ')',
+ '[{}]',
+ '0&&2',
+ '1%2',
+ '1 + 2.5',
+ '1+undefined',
+ '4()',
+ '5=4',
+ '6[3]',
+ '{a',
+ 'a[1]=2',
+ 'a=1;b=3;a+b',
+ 'a.b',
+ 'a(b',
+ '\'a\' + \'b c\'',
+ 'a().name',
+ 'a[x()]()',
+ 'boo',
+ '[].count(',
+ 'doesNotExist()',
+ 'false',
+ 'false && run()',
+ '!false || true',
+ 'foo()',
+ '\$id',
+ 'items[1] = "abc"',
+ 'items[1].name',
+ 'list[3] = 2',
+ 'map["square"] = 6',
+ 'method',
+ 'method()',
+ 'notAFn()',
+ 'notmixed',
+ 'obj[0].name=1',
+ 'obj.field = 1',
+ 'obj.field.key = 4',
+ 'obj.integer = "hello"',
+ 'obj.map.mapKey = 3',
+ 'obj.nested.field = 1',
+ 'obj.overload = 7',
+ 'obj.setter = 2',
+ 'str',
+ 'str="bob"',
+ 'suffix = "!"',
+ 'taxRate / 100 * subTotal',
+ 'true',
+ 'true || run()',
+ 'undefined',
+
+ ';;1;;',
+ '1==1',
+ '!(11 == 10)',
+ '1 + -2.5',
+ '[{a',
+ 'array[5=4]',
+ '\$root',
+ 'subTotal * taxRate / 100',
+ '!!true',
+
+ '1!=2',
+ '1+2*3/4',
+ '\$parent',
+ '{true',
+
+ '0--1+1.5',
+ '1<2',
+ '1<=1',
+
+ '1>2',
+ '{a:\'-\'}',
+ '{a:a}',
+ '[{a:[]}, {b:1}]',
+ '{true:"a", false:"b"}[!!true]',
+
+ '2>=1',
+ 'true==2<3',
+ '6[3]=2',
+
+ 'map.dot = 7',
+ 'exists(doesNotExist())',
+ 'doesNotExists(exists())',
+ 'a[0]()',
+ '{}()',
+ 'items[1]',
+ "-0--1++2*-3/-4",
+ "1/2*3",
+ "0||2",
+ "0||1&&2",
+ 'undefined+1',
+ "12/6/2",
+ "a=undefined",
+ 'add(a,b)',
+ 'notAProperty',
+ "'Foo'|uppercase",
+ "1|increment:2",
+ "'abcd'|substring:1:offset",
+ "'abcd'|substring:1:3|uppercase",
+ "3*4~/2%5",
+ "7==3+4?10:20",
+ "false?10:20",
+ "5?10:20",
+ "null?10:20",
+ "true||false?10:20",
+ "true&&false?10:20",
+ "true?a=10:a=20",
+ "b=true?a=false?11:c=12:a=13",
+ '0?0:2',
+ '1?0:2',
+ '0?0?0:0:2',
+ '1?0?0:0:2',
+ '0?1?0:0:2',
+ '0?0?1:0:2',
+ '0?0?0:2:3',
+ '1?1?0:0:2',
+ '1?1?1:0:2',
+ '1?1?1:2:3',
+ '0?0:0?0:2',
+ '1?0:0?0:2',
+ '0?1:0?0:2',
+ '0?0:1?0:2',
+ '0?0:0?2:3',
+ '1?1:0?0:2',
+ '1?1:1?0:2',
+ '1?1:1?2:3',
+ '0&&1?0:1',
+ '1||0?0:0',
+ '0?0&&1:2',
+ '0?1&&1:2',
+ '0?0||0:1',
+ '0?0||1:2',
+ '1?0&&1:2',
+ '1?1&&1:2',
+ '1?0||0:1',
+ '1?0||1:2',
+ '0?1:0&&1',
+ '0?2:1&&1',
+ '0?1:0||0',
+ '0?2:0||1',
+ '1?1:0&&1',
+ '1?2:1&&1',
+ '1?1:0||0',
+ '1?2:0||1',
+ 'returnTrue() ? returnString() : returnInt()',
+ 'returnFalse() ? returnString() : returnInt()',
+ 'identity(returnFalse() ? returnString() : returnInt())',
+ "taxRate ~/ 100 * subTotal",
+ "'fOo'|uppercase|lowercase",
+ "n = (name|lowercase)",
+ "n",
+ "1|nonexistent"
+ ]);
+}

Powered by Google App Engine
This is Rietveld 408576698