Files
sdk/tests/dart2js_2/native/hash_code_test.dart
T
Joshua Litt 451694e855 [dart2js] Move dart2js_native to dart2js/native.
Change-Id: I2f879fe18376b8c1b82fc201d488425dc154d2b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149341
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-06-04 18:11:49 +00:00

39 lines
732 B
Dart

// Copyright (c) 2012, 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.
// @dart = 2.7
import 'native_testing.dart';
@Native("A")
class A {}
@Native("B")
class B {
int get hashCode => 1234567;
}
makeA() native;
makeB() native;
void setup() {
JS('', r"""
(function(){
function A() {}
function B() {}
makeA = function(){return new A()};
makeB = function(){return new B()};
self.nativeConstructor(A);
self.nativeConstructor(B);
})()""");
}
main() {
nativeTesting();
setup();
Expect.isTrue(makeA().hashCode is int);
Expect.equals(1234567, makeB().hashCode);
}