Chromium Code Reviews| Index: tests/lib_strong/html/debugger_test.dart |
| diff --git a/tests/lib_strong/html/debugger_test.dart b/tests/lib_strong/html/debugger_test.dart |
| index 37384fe27536f514b5bda151f27bc7806186daec..7770b81fe083458663f3774a90e595025ca1f787 100644 |
| --- a/tests/lib_strong/html/debugger_test.dart |
| +++ b/tests/lib_strong/html/debugger_test.dart |
| @@ -62,6 +62,12 @@ external stringify(value, [Function replacer, int space]); |
| @JS('dart_library.import') |
| external importDartLibrary(String path); |
| +@JS('ExampleJSClass') |
| +class ExampleJSClass<T> { |
| + external factory ExampleJSClass(T x); |
| + external T get x; |
| +} |
| + |
| // Replacer normalizes file names that could vary depending on the test runner. |
| // styles. |
| replacer(String key, value) { |
| @@ -117,6 +123,14 @@ main() { |
| print("Warning: no devtools custom formatters specified. Skipping tests."); |
| return; |
| } |
| + document.body.append(new ScriptElement() |
| + ..type = 'text/javascript' |
| + ..innerHtml = r""" |
| +window.ExampleJSClass = function ExampleJSClass(x) { |
| + this.x = x; |
| +}; |
| +"""); |
| + |
| var _devtoolsFormatter = devtoolsFormatters.first; |
| var actual = new StringBuffer(); |
| @@ -278,6 +292,15 @@ main() { |
| addNestedFormatterGoldens('HttpRequest', new HttpRequest()); |
| }); |
| + group('Generics formatting', () { |
| + addNestedFormatterGoldens( |
| + 'TestGenericClass', new TestGenericClass<int, List>(42)); |
| + addNestedFormatterGoldens( |
| + 'TestGenericClassJSInterop', |
| + new TestGenericClass<ExampleJSClass<String>, int>( |
| + new ExampleJSClass("Hello"))); |
| + }); |
| + |
| test('verify golden match', () { |
| // Warning: all other test groups must have run for this test to be meaningful |
| print("Actual:##############\n$actual\n#################"); |
| @@ -1852,6 +1875,34 @@ Value: |
| { |
| "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| }, |
| + "toString: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "none" |
| + } |
| + } |
| + ] |
| + ] |
| + ], |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| "where: " |
| ], |
| [ |
| @@ -3394,6 +3445,34 @@ Value: |
| { |
| "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| }, |
| + "toString: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "none" |
| + } |
| + } |
| + ] |
| + ] |
| + ], |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| "where: " |
| ], |
| [ |
| @@ -4803,7 +4882,7 @@ Value: |
| { |
| "style": "background-color: #d9edf7;" |
| }, |
| - "JsLinkedHashMap<Object, Object> length 3" |
| + "JsLinkedHashMap length 3" |
| ] |
| ----------------------------------- |
| Test: Map<dynamic, dynamic> instance body |
| @@ -4934,7 +5013,7 @@ Value: |
| { |
| "style": "background-color: #d9edf7;" |
| }, |
| - "JsLinkedHashMap<Object, Object> implements LinkedHashMap<Object, Object>, InternalMap<Object, Object>" |
| + "JsLinkedHashMap implements LinkedHashMap, InternalMap" |
| ] |
| ----------------------------------- |
| Test: Map<dynamic, dynamic> definition formatting body |
| @@ -5408,6 +5487,34 @@ Value: |
| { |
| "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| }, |
| + "toString: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "none" |
| + } |
| + } |
| + ] |
| + ] |
| + ], |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| "_addHashTableEntry: " |
| ], |
| [ |
| @@ -8813,4 +8920,244 @@ Value: |
| ] |
| ] |
| ----------------------------------- |
| +Test: TestGenericClass instance header |
| +Value: |
| +[ |
| + "span", |
| + { |
| + "style": "background-color: #d9edf7;" |
| + }, |
| + "TestGenericClass<int, List>" |
| +] |
| +----------------------------------- |
| +Test: TestGenericClass instance body |
| +Value: |
| +[ |
| + "ol", |
| + { |
| + "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;" |
| + }, |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + {}, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| + "x: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + "42" |
| + ] |
| + ] |
| + ], |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| + "[[class]]: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "asClass" |
| + } |
| + } |
| + ] |
| + ] |
| + ] |
| +] |
| +----------------------------------- |
| +Test: TestGenericClass definition formatting header |
| +Value: |
| +[ |
| + "span", |
| + { |
| + "style": "background-color: #d9edf7;" |
| + }, |
| + "TestGenericClass<int, List>" |
| +] |
| +----------------------------------- |
| +Test: TestGenericClass definition formatting body |
| +Value: |
| +[ |
| + "ol", |
| + { |
| + "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;" |
| + }, |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| + "[[base class]]: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "asClass" |
| + } |
| + } |
| + ] |
| + ] |
| + ] |
| +] |
| +----------------------------------- |
| +Test: TestGenericClassJSInterop instance header |
| +Value: |
| +[ |
| + "span", |
| + { |
| + "style": "background-color: #d9edf7;" |
| + }, |
| + "TestGenericClass<JSObject<ExampleJSClass>, int>" |
| +] |
| +----------------------------------- |
| +Test: TestGenericClassJSInterop instance body |
| +Value: |
| +[ |
| + "ol", |
| + { |
| + "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;" |
| + }, |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| + "x: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "none" |
| + } |
| + } |
| + ] |
| + ] |
| + ], |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| + "[[class]]: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "asClass" |
| + } |
| + } |
| + ] |
| + ] |
| + ] |
| +] |
| +----------------------------------- |
| +Test: TestGenericClassJSInterop definition formatting header |
| +Value: |
| +[ |
| + "span", |
| + { |
| + "style": "background-color: #d9edf7;" |
| + }, |
| + "TestGenericClass<JSObject<ExampleJSClass>, int>" |
| +] |
| +----------------------------------- |
| +Test: TestGenericClassJSInterop definition formatting body |
| +Value: |
| +[ |
| + "ol", |
| + { |
| + "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;" |
| + }, |
| + [ |
| + "li", |
| + { |
| + "style": "padding-left: 13px;" |
| + }, |
| + [ |
| + "span", |
| + { |
| + "style": "color: rgb(136, 19, 145); margin-right: -13px" |
| + }, |
| + "[[base class]]: " |
| + ], |
| + [ |
| + "span", |
| + { |
| + "style": "margin-left: 13px" |
| + }, |
| + [ |
| + "object", |
| + { |
| + "object": "<OBJECT>", |
| + "config": { |
| + "name": "asClass" |
| + } |
| + } |
| + ] |
| + ] |
| + ] |
| +] |
| +----------------------------------- |
| """; |
|
vsm
2017/03/31 15:14:08
How about putting this literal into a helper file
Jacob
2017/04/01 00:51:13
Made it a little easier by adding a button to copy
|