blob: adea05ebcc8e20090d5e558c5d139d203f4ef35b [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library prototest;
import 'package:js/js.dart';
import 'package:expect/expect.dart';
external Class get arrayBufferClass;
class Class {
external dynamic get prototype;
external Constructor get constructor;
external String get name;
class Normal {
int prototype = 42;
Normal constructor() {
return this;
int operator [](int i) => prototype;
class Constructor {
external String get name;
void main() {
Expect.isTrue(arrayBufferClass.prototype != null);
var normal = new Normal();
Expect.equals(42, normal.prototype);
Expect.equals(42, normal[0]);
Expect.isTrue(arrayBufferClass.constructor != null);
Expect.isTrue(arrayBufferClass.constructor is Function);
Expect.isTrue(arrayBufferClass.constructor is Constructor);
Expect.isTrue(normal.constructor is Function);
Expect.equals(normal, normal.constructor());