| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Test for named parameter with the name of a JavaScript property found on | |
| 6 // 'Object'. For such a NAME, foo.NAME may exist in an empty map, i.e. | |
| 7 // 'toString' in {} --> true. | |
| 8 | |
| 9 | |
| 10 main() { | |
| 11 // Test properties found on instances of Object in Chrome 15 and Firefox 6. | |
| 12 test_constructor(); | |
| 13 test___proto__(); | |
| 14 test___defineGetter__(); | |
| 15 test___defineSetter__(); | |
| 16 test___lookupGetter__(); | |
| 17 test___lookupSetter__(); | |
| 18 test___noSuchMethod__(); | |
| 19 test_hasOwnProperty(); | |
| 20 test_isPrototypeOf(); | |
| 21 test_propertyIsEnumerable(); | |
| 22 test_toSource(); | |
| 23 test_toLocaleString(); | |
| 24 test_toString(); | |
| 25 test_unwatch(); | |
| 26 test_valueOf(); | |
| 27 test_watch(); | |
| 28 } | |
| 29 | |
| 30 // 'constructor' property. | |
| 31 | |
| 32 class TestClass_constructor { | |
| 33 method([constructor]) => constructor; | |
| 34 static staticMethod([constructor]) => constructor; | |
| 35 } | |
| 36 globalMethod_constructor([constructor]) => constructor; | |
| 37 | |
| 38 test_constructor() { | |
| 39 var obj = new TestClass_constructor(); | |
| 40 | |
| 41 Expect.equals(null, obj.method()); | |
| 42 Expect.equals(0, obj.method(constructor: 0)); | |
| 43 | |
| 44 Expect.equals(null, TestClass_constructor.staticMethod()); | |
| 45 Expect.equals(0, TestClass_constructor.staticMethod(constructor: 0)); | |
| 46 | |
| 47 Expect.equals(null, globalMethod_constructor()); | |
| 48 Expect.equals(0, globalMethod_constructor(constructor: 0)); | |
| 49 } | |
| 50 | |
| 51 // '__proto__' property. | |
| 52 | |
| 53 class TestClass___proto__ { | |
| 54 method([__proto__]) => __proto__; | |
| 55 static staticMethod([__proto__]) => __proto__; | |
| 56 } | |
| 57 globalMethod___proto__([__proto__]) => __proto__; | |
| 58 | |
| 59 test___proto__() { | |
| 60 var obj = new TestClass___proto__(); | |
| 61 | |
| 62 Expect.equals(null, obj.method()); | |
| 63 Expect.equals(0, obj.method(__proto__: 0)); | |
| 64 | |
| 65 Expect.equals(null, TestClass___proto__.staticMethod()); | |
| 66 Expect.equals(0, TestClass___proto__.staticMethod(__proto__: 0)); | |
| 67 | |
| 68 Expect.equals(null, globalMethod___proto__()); | |
| 69 Expect.equals(0, globalMethod___proto__(__proto__: 0)); | |
| 70 } | |
| 71 | |
| 72 // '__defineGetter__' property. | |
| 73 | |
| 74 class TestClass___defineGetter__ { | |
| 75 method([__defineGetter__]) => __defineGetter__; | |
| 76 static staticMethod([__defineGetter__]) => __defineGetter__; | |
| 77 } | |
| 78 globalMethod___defineGetter__([__defineGetter__]) => __defineGetter__; | |
| 79 | |
| 80 test___defineGetter__() { | |
| 81 var obj = new TestClass___defineGetter__(); | |
| 82 | |
| 83 Expect.equals(null, obj.method()); | |
| 84 Expect.equals(0, obj.method(__defineGetter__: 0)); | |
| 85 | |
| 86 Expect.equals(null, TestClass___defineGetter__.staticMethod()); | |
| 87 Expect.equals(0, TestClass___defineGetter__.staticMethod(__defineGetter__: 0))
; | |
| 88 | |
| 89 Expect.equals(null, globalMethod___defineGetter__()); | |
| 90 Expect.equals(0, globalMethod___defineGetter__(__defineGetter__: 0)); | |
| 91 } | |
| 92 | |
| 93 // '__defineSetter__' property. | |
| 94 | |
| 95 class TestClass___defineSetter__ { | |
| 96 method([__defineSetter__]) => __defineSetter__; | |
| 97 static staticMethod([__defineSetter__]) => __defineSetter__; | |
| 98 } | |
| 99 globalMethod___defineSetter__([__defineSetter__]) => __defineSetter__; | |
| 100 | |
| 101 test___defineSetter__() { | |
| 102 var obj = new TestClass___defineSetter__(); | |
| 103 | |
| 104 Expect.equals(null, obj.method()); | |
| 105 Expect.equals(0, obj.method(__defineSetter__: 0)); | |
| 106 | |
| 107 Expect.equals(null, TestClass___defineSetter__.staticMethod()); | |
| 108 Expect.equals(0, TestClass___defineSetter__.staticMethod(__defineSetter__: 0))
; | |
| 109 | |
| 110 Expect.equals(null, globalMethod___defineSetter__()); | |
| 111 Expect.equals(0, globalMethod___defineSetter__(__defineSetter__: 0)); | |
| 112 } | |
| 113 | |
| 114 // '__lookupGetter__' property. | |
| 115 | |
| 116 class TestClass___lookupGetter__ { | |
| 117 method([__lookupGetter__]) => __lookupGetter__; | |
| 118 static staticMethod([__lookupGetter__]) => __lookupGetter__; | |
| 119 } | |
| 120 globalMethod___lookupGetter__([__lookupGetter__]) => __lookupGetter__; | |
| 121 | |
| 122 test___lookupGetter__() { | |
| 123 var obj = new TestClass___lookupGetter__(); | |
| 124 | |
| 125 Expect.equals(null, obj.method()); | |
| 126 Expect.equals(0, obj.method(__lookupGetter__: 0)); | |
| 127 | |
| 128 Expect.equals(null, TestClass___lookupGetter__.staticMethod()); | |
| 129 Expect.equals(0, TestClass___lookupGetter__.staticMethod(__lookupGetter__: 0))
; | |
| 130 | |
| 131 Expect.equals(null, globalMethod___lookupGetter__()); | |
| 132 Expect.equals(0, globalMethod___lookupGetter__(__lookupGetter__: 0)); | |
| 133 } | |
| 134 | |
| 135 // '__lookupSetter__' property. | |
| 136 | |
| 137 class TestClass___lookupSetter__ { | |
| 138 method([__lookupSetter__]) => __lookupSetter__; | |
| 139 static staticMethod([__lookupSetter__]) => __lookupSetter__; | |
| 140 } | |
| 141 globalMethod___lookupSetter__([__lookupSetter__]) => __lookupSetter__; | |
| 142 | |
| 143 test___lookupSetter__() { | |
| 144 var obj = new TestClass___lookupSetter__(); | |
| 145 | |
| 146 Expect.equals(null, obj.method()); | |
| 147 Expect.equals(0, obj.method(__lookupSetter__: 0)); | |
| 148 | |
| 149 Expect.equals(null, TestClass___lookupSetter__.staticMethod()); | |
| 150 Expect.equals(0, TestClass___lookupSetter__.staticMethod(__lookupSetter__: 0))
; | |
| 151 | |
| 152 Expect.equals(null, globalMethod___lookupSetter__()); | |
| 153 Expect.equals(0, globalMethod___lookupSetter__(__lookupSetter__: 0)); | |
| 154 } | |
| 155 | |
| 156 // '__noSuchMethod__' property. | |
| 157 | |
| 158 class TestClass___noSuchMethod__ { | |
| 159 method([__noSuchMethod__]) => __noSuchMethod__; | |
| 160 static staticMethod([__noSuchMethod__]) => __noSuchMethod__; | |
| 161 } | |
| 162 globalMethod___noSuchMethod__([__noSuchMethod__]) => __noSuchMethod__; | |
| 163 | |
| 164 test___noSuchMethod__() { | |
| 165 var obj = new TestClass___noSuchMethod__(); | |
| 166 | |
| 167 Expect.equals(null, obj.method()); | |
| 168 Expect.equals(0, obj.method(__noSuchMethod__: 0)); | |
| 169 | |
| 170 Expect.equals(null, TestClass___noSuchMethod__.staticMethod()); | |
| 171 Expect.equals(0, TestClass___noSuchMethod__.staticMethod(__noSuchMethod__: 0))
; | |
| 172 | |
| 173 Expect.equals(null, globalMethod___noSuchMethod__()); | |
| 174 Expect.equals(0, globalMethod___noSuchMethod__(__noSuchMethod__: 0)); | |
| 175 } | |
| 176 | |
| 177 // 'hasOwnProperty' property. | |
| 178 | |
| 179 class TestClass_hasOwnProperty { | |
| 180 method([hasOwnProperty]) => hasOwnProperty; | |
| 181 static staticMethod([hasOwnProperty]) => hasOwnProperty; | |
| 182 } | |
| 183 globalMethod_hasOwnProperty([hasOwnProperty]) => hasOwnProperty; | |
| 184 | |
| 185 test_hasOwnProperty() { | |
| 186 var obj = new TestClass_hasOwnProperty(); | |
| 187 | |
| 188 Expect.equals(null, obj.method()); | |
| 189 Expect.equals(0, obj.method(hasOwnProperty: 0)); | |
| 190 | |
| 191 Expect.equals(null, TestClass_hasOwnProperty.staticMethod()); | |
| 192 Expect.equals(0, TestClass_hasOwnProperty.staticMethod(hasOwnProperty: 0)); | |
| 193 | |
| 194 Expect.equals(null, globalMethod_hasOwnProperty()); | |
| 195 Expect.equals(0, globalMethod_hasOwnProperty(hasOwnProperty: 0)); | |
| 196 } | |
| 197 | |
| 198 // 'isPrototypeOf' property. | |
| 199 | |
| 200 class TestClass_isPrototypeOf { | |
| 201 method([isPrototypeOf]) => isPrototypeOf; | |
| 202 static staticMethod([isPrototypeOf]) => isPrototypeOf; | |
| 203 } | |
| 204 globalMethod_isPrototypeOf([isPrototypeOf]) => isPrototypeOf; | |
| 205 | |
| 206 test_isPrototypeOf() { | |
| 207 var obj = new TestClass_isPrototypeOf(); | |
| 208 | |
| 209 Expect.equals(null, obj.method()); | |
| 210 Expect.equals(0, obj.method(isPrototypeOf: 0)); | |
| 211 | |
| 212 Expect.equals(null, TestClass_isPrototypeOf.staticMethod()); | |
| 213 Expect.equals(0, TestClass_isPrototypeOf.staticMethod(isPrototypeOf: 0)); | |
| 214 | |
| 215 Expect.equals(null, globalMethod_isPrototypeOf()); | |
| 216 Expect.equals(0, globalMethod_isPrototypeOf(isPrototypeOf: 0)); | |
| 217 } | |
| 218 | |
| 219 // 'propertyIsEnumerable' property. | |
| 220 | |
| 221 class TestClass_propertyIsEnumerable { | |
| 222 method([propertyIsEnumerable]) => propertyIsEnumerable; | |
| 223 static staticMethod([propertyIsEnumerable]) => propertyIsEnumerable; | |
| 224 } | |
| 225 globalMethod_propertyIsEnumerable([propertyIsEnumerable]) => propertyIsEnumerabl
e; | |
| 226 | |
| 227 test_propertyIsEnumerable() { | |
| 228 var obj = new TestClass_propertyIsEnumerable(); | |
| 229 | |
| 230 Expect.equals(null, obj.method()); | |
| 231 Expect.equals(0, obj.method(propertyIsEnumerable: 0)); | |
| 232 | |
| 233 Expect.equals(null, TestClass_propertyIsEnumerable.staticMethod()); | |
| 234 Expect.equals(0, TestClass_propertyIsEnumerable.staticMethod(propertyIsEnumera
ble: 0)); | |
| 235 | |
| 236 Expect.equals(null, globalMethod_propertyIsEnumerable()); | |
| 237 Expect.equals(0, globalMethod_propertyIsEnumerable(propertyIsEnumerable: 0)); | |
| 238 } | |
| 239 | |
| 240 // 'toSource' property. | |
| 241 | |
| 242 class TestClass_toSource { | |
| 243 method([toSource]) => toSource; | |
| 244 static staticMethod([toSource]) => toSource; | |
| 245 } | |
| 246 globalMethod_toSource([toSource]) => toSource; | |
| 247 | |
| 248 test_toSource() { | |
| 249 var obj = new TestClass_toSource(); | |
| 250 | |
| 251 Expect.equals(null, obj.method()); | |
| 252 Expect.equals(0, obj.method(toSource: 0)); | |
| 253 | |
| 254 Expect.equals(null, TestClass_toSource.staticMethod()); | |
| 255 Expect.equals(0, TestClass_toSource.staticMethod(toSource: 0)); | |
| 256 | |
| 257 Expect.equals(null, globalMethod_toSource()); | |
| 258 Expect.equals(0, globalMethod_toSource(toSource: 0)); | |
| 259 } | |
| 260 | |
| 261 // 'toLocaleString' property. | |
| 262 | |
| 263 class TestClass_toLocaleString { | |
| 264 method([toLocaleString]) => toLocaleString; | |
| 265 static staticMethod([toLocaleString]) => toLocaleString; | |
| 266 } | |
| 267 globalMethod_toLocaleString([toLocaleString]) => toLocaleString; | |
| 268 | |
| 269 test_toLocaleString() { | |
| 270 var obj = new TestClass_toLocaleString(); | |
| 271 | |
| 272 Expect.equals(null, obj.method()); | |
| 273 Expect.equals(0, obj.method(toLocaleString: 0)); | |
| 274 | |
| 275 Expect.equals(null, TestClass_toLocaleString.staticMethod()); | |
| 276 Expect.equals(0, TestClass_toLocaleString.staticMethod(toLocaleString: 0)); | |
| 277 | |
| 278 Expect.equals(null, globalMethod_toLocaleString()); | |
| 279 Expect.equals(0, globalMethod_toLocaleString(toLocaleString: 0)); | |
| 280 } | |
| 281 | |
| 282 // 'toString' property. | |
| 283 | |
| 284 class TestClass_toString { | |
| 285 method([toString]) => toString; | |
| 286 static staticMethod([toString]) => toString; | |
| 287 } | |
| 288 globalMethod_toString([toString]) => toString; | |
| 289 | |
| 290 test_toString() { | |
| 291 var obj = new TestClass_toString(); | |
| 292 | |
| 293 Expect.equals(null, obj.method()); | |
| 294 Expect.equals(0, obj.method(toString: 0)); | |
| 295 | |
| 296 Expect.equals(null, TestClass_toString.staticMethod()); | |
| 297 Expect.equals(0, TestClass_toString.staticMethod(toString: 0)); | |
| 298 | |
| 299 Expect.equals(null, globalMethod_toString()); | |
| 300 Expect.equals(0, globalMethod_toString(toString: 0)); | |
| 301 } | |
| 302 | |
| 303 // 'unwatch' property. | |
| 304 | |
| 305 class TestClass_unwatch { | |
| 306 method([unwatch]) => unwatch; | |
| 307 static staticMethod([unwatch]) => unwatch; | |
| 308 } | |
| 309 globalMethod_unwatch([unwatch]) => unwatch; | |
| 310 | |
| 311 test_unwatch() { | |
| 312 var obj = new TestClass_unwatch(); | |
| 313 | |
| 314 Expect.equals(null, obj.method()); | |
| 315 Expect.equals(0, obj.method(unwatch: 0)); | |
| 316 | |
| 317 Expect.equals(null, TestClass_unwatch.staticMethod()); | |
| 318 Expect.equals(0, TestClass_unwatch.staticMethod(unwatch: 0)); | |
| 319 | |
| 320 Expect.equals(null, globalMethod_unwatch()); | |
| 321 Expect.equals(0, globalMethod_unwatch(unwatch: 0)); | |
| 322 } | |
| 323 | |
| 324 // 'valueOf' property. | |
| 325 | |
| 326 class TestClass_valueOf { | |
| 327 method([valueOf]) => valueOf; | |
| 328 static staticMethod([valueOf]) => valueOf; | |
| 329 } | |
| 330 globalMethod_valueOf([valueOf]) => valueOf; | |
| 331 | |
| 332 test_valueOf() { | |
| 333 var obj = new TestClass_valueOf(); | |
| 334 | |
| 335 Expect.equals(null, obj.method()); | |
| 336 Expect.equals(0, obj.method(valueOf: 0)); | |
| 337 | |
| 338 Expect.equals(null, TestClass_valueOf.staticMethod()); | |
| 339 Expect.equals(0, TestClass_valueOf.staticMethod(valueOf: 0)); | |
| 340 | |
| 341 Expect.equals(null, globalMethod_valueOf()); | |
| 342 Expect.equals(0, globalMethod_valueOf(valueOf: 0)); | |
| 343 } | |
| 344 | |
| 345 // 'watch' property. | |
| 346 | |
| 347 class TestClass_watch { | |
| 348 method([watch]) => watch; | |
| 349 static staticMethod([watch]) => watch; | |
| 350 } | |
| 351 globalMethod_watch([watch]) => watch; | |
| 352 | |
| 353 test_watch() { | |
| 354 var obj = new TestClass_watch(); | |
| 355 | |
| 356 Expect.equals(null, obj.method()); | |
| 357 Expect.equals(0, obj.method(watch: 0)); | |
| 358 | |
| 359 Expect.equals(null, TestClass_watch.staticMethod()); | |
| 360 Expect.equals(0, TestClass_watch.staticMethod(watch: 0)); | |
| 361 | |
| 362 Expect.equals(null, globalMethod_watch()); | |
| 363 Expect.equals(0, globalMethod_watch(watch: 0)); | |
| 364 } | |
| OLD | NEW |