Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: tests/isolate/static_function_test.dart

Issue 68813002: Fix VM not accepting static methods for Isolate.spawn. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated and extended tests. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 starting isolate with static functions (and toplevel ones, for sanity).
6 // VMOptions=--enable_type_checks --enable_asserts
Ivan Posva 2013/11/12 07:19:49 Why are you enforcing these VM options here?
Lasse Reichstein Nielsen 2013/11/12 07:28:51 Not needed. They were in the test file I started o
7
8 library static_function_test;
9 import 'dart:isolate';
10 import 'dart:async';
11 import 'static_function_testlib.dart' as lib;
12 import '../../pkg/unittest/lib/unittest.dart';
13
14 void function(SendPort port) { port.send("TOP"); }
15 void _function(SendPort port) { port.send("_TOP"); }
16
17 class C {
18 static function(SendPort port) { port.send("YES"); }
19 static _function(SendPort port) { port.send("PRIVATE"); }
20 }
21
22 class _C {
23 static function(SendPort port) { port.send("_YES"); }
24 static _function(SendPort port) { port.send("_PRIVATE"); }
25 }
26
27 void spawnTest(name, function, response) {
28 test(name, () {
29 ReceivePort r = new ReceivePort();
30 Isolate.spawn(function, r.sendPort);
31 r.listen(expectAsync1((v) {
32 expect(v, response);
33 r.close();
34 }));
35 });
36 }
37
38 void main() {
39 // Sanity check.
40 spawnTest("function", function, "TOP");
41 spawnTest("_function", _function, "_TOP");
42 spawnTest("lib.function", lib.function, "LIBTOP");
43 spawnTest("lib._function", lib.privateFunction, "_LIBTOP");
44
45 // Local static functions.
46 spawnTest("class.function", C.function, "YES");
47 spawnTest("class._function", C._function, "PRIVATE");
48 spawnTest("_class._function", _C.function, "_YES");
49 spawnTest("_class._function", _C._function, "_PRIVATE");
50
51 // Imported static functions.
52 spawnTest("lib.class.function", lib.C.function, "LIB");
53 spawnTest("lib.class._function", lib.C.privateFunction, "LIBPRIVATE");
54 spawnTest("lib._class._function", lib.privateClassFunction, "_LIB");
55 spawnTest("lib._class._function", lib.privateClassAndFunction, "_LIBPRIVATE");
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698