| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 // Test for named parameter with the name of a JavaScript property found on | 7 // Test for named parameter with the name of a JavaScript property found on |
| 8 // 'Object'. For such a NAME, foo.NAME may exist in an empty map, i.e. | 8 // 'Object'. For such a NAME, foo.NAME may exist in an empty map, i.e. |
| 9 // 'toString' in {} --> true. | 9 // 'toString' in {} --> true. |
| 10 | 10 |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 // Test properties found on instances of Object in Chrome 15 and Firefox 6. | 13 // Test properties found on instances of Object in Chrome 15 and Firefox 6. |
| 14 test_constructor(); | 14 test_constructor(); |
| 15 test___proto__(); | |
| 16 test___defineGetter__(); | |
| 17 test___defineSetter__(); | |
| 18 test___lookupGetter__(); | |
| 19 test___lookupSetter__(); | |
| 20 test___noSuchMethod__(); | |
| 21 test_hasOwnProperty(); | 15 test_hasOwnProperty(); |
| 22 test_isPrototypeOf(); | 16 test_isPrototypeOf(); |
| 23 test_propertyIsEnumerable(); | 17 test_propertyIsEnumerable(); |
| 24 test_toSource(); | 18 test_toSource(); |
| 25 test_toLocaleString(); | 19 test_toLocaleString(); |
| 26 test_toString(); | 20 test_toString(); |
| 27 test_unwatch(); | 21 test_unwatch(); |
| 28 test_valueOf(); | 22 test_valueOf(); |
| 29 test_watch(); | 23 test_watch(); |
| 30 } | 24 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 43 Expect.equals(null, obj.method()); | 37 Expect.equals(null, obj.method()); |
| 44 Expect.equals(0, obj.method(constructor: 0)); | 38 Expect.equals(0, obj.method(constructor: 0)); |
| 45 | 39 |
| 46 Expect.equals(null, TestClass_constructor.staticMethod()); | 40 Expect.equals(null, TestClass_constructor.staticMethod()); |
| 47 Expect.equals(0, TestClass_constructor.staticMethod(constructor: 0)); | 41 Expect.equals(0, TestClass_constructor.staticMethod(constructor: 0)); |
| 48 | 42 |
| 49 Expect.equals(null, globalMethod_constructor()); | 43 Expect.equals(null, globalMethod_constructor()); |
| 50 Expect.equals(0, globalMethod_constructor(constructor: 0)); | 44 Expect.equals(0, globalMethod_constructor(constructor: 0)); |
| 51 } | 45 } |
| 52 | 46 |
| 53 // '__proto__' property. | |
| 54 | |
| 55 class TestClass___proto__ { | |
| 56 method({__proto__}) => __proto__; | |
| 57 static staticMethod({__proto__}) => __proto__; | |
| 58 } | |
| 59 globalMethod___proto__({__proto__}) => __proto__; | |
| 60 | |
| 61 test___proto__() { | |
| 62 var obj = new TestClass___proto__(); | |
| 63 | |
| 64 Expect.equals(null, obj.method()); | |
| 65 Expect.equals(0, obj.method(__proto__: 0)); | |
| 66 | |
| 67 Expect.equals(null, TestClass___proto__.staticMethod()); | |
| 68 Expect.equals(0, TestClass___proto__.staticMethod(__proto__: 0)); | |
| 69 | |
| 70 Expect.equals(null, globalMethod___proto__()); | |
| 71 Expect.equals(0, globalMethod___proto__(__proto__: 0)); | |
| 72 } | |
| 73 | |
| 74 // '__defineGetter__' property. | |
| 75 | |
| 76 class TestClass___defineGetter__ { | |
| 77 method({__defineGetter__}) => __defineGetter__; | |
| 78 static staticMethod({__defineGetter__}) => __defineGetter__; | |
| 79 } | |
| 80 globalMethod___defineGetter__({__defineGetter__}) => __defineGetter__; | |
| 81 | |
| 82 test___defineGetter__() { | |
| 83 var obj = new TestClass___defineGetter__(); | |
| 84 | |
| 85 Expect.equals(null, obj.method()); | |
| 86 Expect.equals(0, obj.method(__defineGetter__: 0)); | |
| 87 | |
| 88 Expect.equals(null, TestClass___defineGetter__.staticMethod()); | |
| 89 Expect.equals(0, TestClass___defineGetter__.staticMethod(__defineGetter__: 0))
; | |
| 90 | |
| 91 Expect.equals(null, globalMethod___defineGetter__()); | |
| 92 Expect.equals(0, globalMethod___defineGetter__(__defineGetter__: 0)); | |
| 93 } | |
| 94 | |
| 95 // '__defineSetter__' property. | |
| 96 | |
| 97 class TestClass___defineSetter__ { | |
| 98 method({__defineSetter__}) => __defineSetter__; | |
| 99 static staticMethod({__defineSetter__}) => __defineSetter__; | |
| 100 } | |
| 101 globalMethod___defineSetter__({__defineSetter__}) => __defineSetter__; | |
| 102 | |
| 103 test___defineSetter__() { | |
| 104 var obj = new TestClass___defineSetter__(); | |
| 105 | |
| 106 Expect.equals(null, obj.method()); | |
| 107 Expect.equals(0, obj.method(__defineSetter__: 0)); | |
| 108 | |
| 109 Expect.equals(null, TestClass___defineSetter__.staticMethod()); | |
| 110 Expect.equals(0, TestClass___defineSetter__.staticMethod(__defineSetter__: 0))
; | |
| 111 | |
| 112 Expect.equals(null, globalMethod___defineSetter__()); | |
| 113 Expect.equals(0, globalMethod___defineSetter__(__defineSetter__: 0)); | |
| 114 } | |
| 115 | |
| 116 // '__lookupGetter__' property. | |
| 117 | |
| 118 class TestClass___lookupGetter__ { | |
| 119 method({__lookupGetter__}) => __lookupGetter__; | |
| 120 static staticMethod({__lookupGetter__}) => __lookupGetter__; | |
| 121 } | |
| 122 globalMethod___lookupGetter__({__lookupGetter__}) => __lookupGetter__; | |
| 123 | |
| 124 test___lookupGetter__() { | |
| 125 var obj = new TestClass___lookupGetter__(); | |
| 126 | |
| 127 Expect.equals(null, obj.method()); | |
| 128 Expect.equals(0, obj.method(__lookupGetter__: 0)); | |
| 129 | |
| 130 Expect.equals(null, TestClass___lookupGetter__.staticMethod()); | |
| 131 Expect.equals(0, TestClass___lookupGetter__.staticMethod(__lookupGetter__: 0))
; | |
| 132 | |
| 133 Expect.equals(null, globalMethod___lookupGetter__()); | |
| 134 Expect.equals(0, globalMethod___lookupGetter__(__lookupGetter__: 0)); | |
| 135 } | |
| 136 | |
| 137 // '__lookupSetter__' property. | |
| 138 | |
| 139 class TestClass___lookupSetter__ { | |
| 140 method({__lookupSetter__}) => __lookupSetter__; | |
| 141 static staticMethod({__lookupSetter__}) => __lookupSetter__; | |
| 142 } | |
| 143 globalMethod___lookupSetter__({__lookupSetter__}) => __lookupSetter__; | |
| 144 | |
| 145 test___lookupSetter__() { | |
| 146 var obj = new TestClass___lookupSetter__(); | |
| 147 | |
| 148 Expect.equals(null, obj.method()); | |
| 149 Expect.equals(0, obj.method(__lookupSetter__: 0)); | |
| 150 | |
| 151 Expect.equals(null, TestClass___lookupSetter__.staticMethod()); | |
| 152 Expect.equals(0, TestClass___lookupSetter__.staticMethod(__lookupSetter__: 0))
; | |
| 153 | |
| 154 Expect.equals(null, globalMethod___lookupSetter__()); | |
| 155 Expect.equals(0, globalMethod___lookupSetter__(__lookupSetter__: 0)); | |
| 156 } | |
| 157 | |
| 158 // '__noSuchMethod__' property. | |
| 159 | |
| 160 class TestClass___noSuchMethod__ { | |
| 161 method({__noSuchMethod__}) => __noSuchMethod__; | |
| 162 static staticMethod({__noSuchMethod__}) => __noSuchMethod__; | |
| 163 } | |
| 164 globalMethod___noSuchMethod__({__noSuchMethod__}) => __noSuchMethod__; | |
| 165 | |
| 166 test___noSuchMethod__() { | |
| 167 var obj = new TestClass___noSuchMethod__(); | |
| 168 | |
| 169 Expect.equals(null, obj.method()); | |
| 170 Expect.equals(0, obj.method(__noSuchMethod__: 0)); | |
| 171 | |
| 172 Expect.equals(null, TestClass___noSuchMethod__.staticMethod()); | |
| 173 Expect.equals(0, TestClass___noSuchMethod__.staticMethod(__noSuchMethod__: 0))
; | |
| 174 | |
| 175 Expect.equals(null, globalMethod___noSuchMethod__()); | |
| 176 Expect.equals(0, globalMethod___noSuchMethod__(__noSuchMethod__: 0)); | |
| 177 } | |
| 178 | |
| 179 // 'hasOwnProperty' property. | 47 // 'hasOwnProperty' property. |
| 180 | 48 |
| 181 class TestClass_hasOwnProperty { | 49 class TestClass_hasOwnProperty { |
| 182 method({hasOwnProperty}) => hasOwnProperty; | 50 method({hasOwnProperty}) => hasOwnProperty; |
| 183 static staticMethod({hasOwnProperty}) => hasOwnProperty; | 51 static staticMethod({hasOwnProperty}) => hasOwnProperty; |
| 184 } | 52 } |
| 185 globalMethod_hasOwnProperty({hasOwnProperty}) => hasOwnProperty; | 53 globalMethod_hasOwnProperty({hasOwnProperty}) => hasOwnProperty; |
| 186 | 54 |
| 187 test_hasOwnProperty() { | 55 test_hasOwnProperty() { |
| 188 var obj = new TestClass_hasOwnProperty(); | 56 var obj = new TestClass_hasOwnProperty(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 225 |
| 358 Expect.equals(null, obj.method()); | 226 Expect.equals(null, obj.method()); |
| 359 Expect.equals(0, obj.method(watch: 0)); | 227 Expect.equals(0, obj.method(watch: 0)); |
| 360 | 228 |
| 361 Expect.equals(null, TestClass_watch.staticMethod()); | 229 Expect.equals(null, TestClass_watch.staticMethod()); |
| 362 Expect.equals(0, TestClass_watch.staticMethod(watch: 0)); | 230 Expect.equals(0, TestClass_watch.staticMethod(watch: 0)); |
| 363 | 231 |
| 364 Expect.equals(null, globalMethod_watch()); | 232 Expect.equals(null, globalMethod_watch()); |
| 365 Expect.equals(0, globalMethod_watch(watch: 0)); | 233 Expect.equals(0, globalMethod_watch(watch: 0)); |
| 366 } | 234 } |
| OLD | NEW |