[repl] Remove repl from tools
TEST=None
Change-Id: Iaad1761cadc41664caa29b8691c1ad8bc0d2f1eb
diff --git a/README.md b/README.md
index 31cabce..0cc4fa5 100644
--- a/README.md
+++ b/README.md
@@ -24,3 +24,4 @@
* topaz/tools/mod: acc1f05718af2bcfbba3317a456f82b67eec4e42
* topaz/tools/widget_explorer: acc1f05718af2bcfbba3317a456f82b67eec4e42
* topaz/examples/bluetooth: f4287c5ae0e9b099983121b41be66e1994b83a02
+* topaz/bin/repl: fc25fb9b825f4100b316c4d5135156ef05e0dc4b
diff --git a/bin/repl/BUILD.gn b/bin/repl/BUILD.gn
deleted file mode 100644
index ee95ba7..0000000
--- a/bin/repl/BUILD.gn
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/package.gni")
-
-package("repl") {
- testonly = true
-
- binaries = [
- {
- name = rebase_path("run_repl_server.sh")
- dest = "run_repl_server.sh"
- },
- ]
-}
diff --git a/bin/repl/run_repl_server.sh b/bin/repl/run_repl_server.sh
deleted file mode 100644
index 05c4d3f..0000000
--- a/bin/repl/run_repl_server.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/boot/bin/sh
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-set -o errexit
-
-# In the event of previous failures from other scripts or other components using
-# the GPU, ensure that all components using the display have been shut down.
-killall basemgr* || true
-killall root_presenter* || true
-killall scenic* || true
-
-# TODO(bgoldman): Create a separate test instead of driver_example_mod_target_tests
-run_test \
- fuchsia-pkg://fuchsia.com/basemgr#meta/basemgr.cmx --test --enable_presenter \
- --account_provider=fuchsia-pkg://fuchsia.com/dev_token_manager#meta/dev_token_manager.cmx \
- --base_shell=fuchsia-pkg://fuchsia.com/dev_base_shell#meta/dev_base_shell.cmx \
- --base_shell_args=--test_timeout_ms=3600000 \
- --session_shell=fuchsia-pkg://fuchsia.com/dev_session_shell#meta/dev_session_shell.cmx \
- --session_shell_args=--root_module=fuchsia-pkg://fuchsia.com/test_driver_module#meta/test_driver_module.cmx,--module_under_test_url=fuchsia-pkg://fuchsia.com/driver_example_mod_wrapper#meta/driver_example_mod_wrapper.cmx,--test_driver_url=fuchsia-pkg://fuchsia.com/driver_example_mod_target_tests#meta/driver_example_mod_target_tests.cmx \
- --story_shell=fuchsia-pkg://fuchsia.com/dev_story_shell#meta/dev_story_shell.cmx
diff --git a/packages/tests/all b/packages/tests/all
index f5cbb41..35f3d89 100644
--- a/packages/tests/all
+++ b/packages/tests/all
@@ -18,7 +18,6 @@
"topaz/packages/tests/flutter_screencap_test_app",
"topaz/packages/tests/key_listener_test",
"topaz/packages/tests/modular_integration_tests",
- "topaz/packages/tests/repl",
"topaz/packages/tests/scenic",
"topaz/packages/tests/sledge",
"topaz/packages/tests/web_runner_tests"
diff --git a/packages/tests/repl b/packages/tests/repl
deleted file mode 100644
index 179e3b8..0000000
--- a/packages/tests/repl
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "packages": [
- "//topaz/bin/repl:repl"
- ]
-}
diff --git a/tools/repl/analysis_options.yaml b/tools/repl/analysis_options.yaml
deleted file mode 100644
index 5ad6dd5..0000000
--- a/tools/repl/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../analysis_options.yaml
diff --git a/tools/repl/lib/fake_main.dart b/tools/repl/lib/fake_main.dart
deleted file mode 100644
index e044636..0000000
--- a/tools/repl/lib/fake_main.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:developer';
-
-// Provides a context for evaluating Dart expressions, for local testing of the
-// REPL without a Fuchsia system.
-class Context {
- int triple(int x) {
- return x * 3;
- }
-
- void run() {
- debugger();
- }
-}
-
-void main() {
- Context().run();
-}
diff --git a/tools/repl/lib/interact.dart b/tools/repl/lib/interact.dart
deleted file mode 100644
index a7904de..0000000
--- a/tools/repl/lib/interact.dart
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:async';
-
-enum Output {
- // Rewrite the prompt line, including text entered by the user.
- prompt,
-
- // Tell the user they did something illegal.
- bell,
-
- // Evaluate a Dart expression and print the result.
- evaluate,
-}
-
-// Interact with the user on the command line, by converting input strings
-// into output events.
-Stream<List<dynamic>> interact(Stream<String> inputs) async* {
- var history = <String>[];
- var historyAt = 0;
-
- var line = '';
- var cursorAt = 0;
-
- List<dynamic> getPrompt() {
- return [Output.prompt, line, cursorAt];
- }
-
- await for (var input in inputs) {
- if (input == '\u{7f}') {
- // Delete
- if (cursorAt == 0) {
- yield [Output.bell];
- } else {
- line = line.substring(0, cursorAt - 1) + line.substring(cursorAt);
- cursorAt--;
- yield getPrompt();
- }
- } else if (input == '\u{1b}[A') {
- // Up
- if (historyAt == 0) {
- yield [Output.bell];
- } else {
- historyAt--;
- line = history[historyAt];
- cursorAt = line.length;
- yield getPrompt();
- }
- } else if (input == '\u{1b}[B') {
- // Down
- if (historyAt >= history.length - 1) {
- yield [Output.bell];
- } else {
- historyAt++;
- line = history[historyAt];
- cursorAt = line.length;
- yield getPrompt();
- }
- } else if (input == '\u{1b}[C') {
- // Forward
- if (cursorAt == line.length) {
- yield [Output.bell];
- } else {
- cursorAt++;
- yield getPrompt();
- }
- } else if (input == '\u{1b}[D') {
- // Back
- if (cursorAt == 0) {
- yield [Output.bell];
- } else {
- cursorAt--;
- yield getPrompt();
- }
- } else {
- var buffer = StringBuffer();
- for (var rune in input.runes) {
- if (rune > 127) {
- // Substitute unicode literals in ASCII, so that we don't have to
- // figure out characters' display width when moving the cursor.
- var hex = rune.toRadixString(16);
- buffer.write('\\u{$hex}');
- } else if (rune == 10) {
- // New line
- line += buffer.toString();
- buffer.clear();
- yield [Output.evaluate, line];
- history.add(line);
- historyAt = history.length;
- line = '';
- cursorAt = 0;
- } else {
- buffer.writeCharCode(rune);
- }
- }
-
- if (buffer.isNotEmpty) {
- line =
- line.substring(0, cursorAt) +
- buffer.toString() +
- line.substring(cursorAt);
- cursorAt += buffer.length;
- yield getPrompt();
- }
- }
- }
-}
diff --git a/tools/repl/lib/main.dart b/tools/repl/lib/main.dart
deleted file mode 100644
index 1f21f26..0000000
--- a/tools/repl/lib/main.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:convert';
-import 'dart:io';
-
-import 'interact.dart';
-import 'remote_vm.dart';
-
-void main(List<String> args) async {
- stdin.lineMode = false;
- stdin.echoMode = false;
-
- var fromUtf8 = Utf8Decoder();
- var inputs = stdin.map((input) => fromUtf8.convert(input));
-
- // How to connect to a Fuchsia Dart test:
- // 1. Add a debugger() pause to a test.
- // 2. Run the test on a Fuchsia device.
- // 3. Tunnel to all available Dart VMs with `fx dart-tunnel`
- // 4. Use the port associated with the test process
- //
- // Or, to test the REPL with a fake main() locally:
- // dart --observe=$port/::1 fake_main.dart
- var vm = RemoteVm();
- var port = args[0];
- await vm.connect('ws://[::1]:$port/ws');
-
- await for (var output in interact(inputs)) {
- if (output[0] == Output.evaluate) {
- String expression = output[1];
- print('');
- print(await vm.evaluate(expression));
- } else if (output[0] == Output.prompt) {
- var line = output[1];
- // Escape codes use one-based indexing.
- var position = output[2] + 1;
- stdout
- // Go to the start of the line.
- ..write('\u{1b}[G')
- // Delete to the end.
- ..write('\u{1b}[K')
- ..write(line)
- ..write('\u{1b}[${position}G');
- } else if (output[0] == Output.bell) {
- stdout.write('\u{7}');
- } else {
- assert(false);
- }
- await stdout.flush();
- }
-}
diff --git a/tools/repl/lib/remote_vm.dart b/tools/repl/lib/remote_vm.dart
deleted file mode 100644
index 9be3b0c..0000000
--- a/tools/repl/lib/remote_vm.dart
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-const int kConnectionAttempts = 3;
-const Duration kConnectionRetryDelay = Duration(seconds: 2);
-
-Future<WebSocket> _connect(String url,
- List<Exception> exceptions) async {
- if (exceptions.length == kConnectionAttempts) {
- throw exceptions.last;
- }
-
- if (exceptions.isNotEmpty) {
- stderr.writeln(exceptions.last.toString());
- stderr.writeln('Retrying...'); // ignore: cascade_invocations
- sleep(kConnectionRetryDelay);
- }
-
- try {
- return await WebSocket.connect(url);
- } on SocketException catch(e) {
- exceptions.add(e);
- return _connect(url, exceptions);
- }
-}
-
-class RemoteVm {
- JsonEncoder toJson = JsonEncoder();
- JsonDecoder fromJson = JsonDecoder();
-
- WebSocket ws;
- String isolateId;
-
- /// We send a unique ID for each request, and the remote VM sends a response
- /// message with the same ID. We need a way to match them.
- ///
- /// The responses map is indexed by request ID. A completer is inserted when
- /// a request is sent, and it is completed when the response is received.
- Map<int, Completer<dynamic>> responses = {};
- int nextId = 0;
-
- Future<void> connect(String url) async {
- ws = await _connect(url, [])..listen(onResponse);
-
- var streamListenResponse = await request('streamListen',
- {'streamId': 'VM'});
- if (streamListenResponse['result']['type'] != 'Success') {
- throw streamListenResponse;
- }
-
- var vmResponse = await request('getVM', {});
- isolateId = vmResponse['result']['isolates'][0]['id'];
- }
-
- void onResponse(dynamic data) {
- var obj = fromJson.convert(data);
- responses[obj['id']].complete(obj);
- }
-
- Future<dynamic> request(String method, dynamic params) {
- var id = nextId++;
- ws.add(toJson.convert({'id': id, 'method': method, 'params': params}));
- var completer = Completer();
- responses[id] = completer;
- return completer.future;
- }
-
- Future<String> evaluate(String expression) async {
- var params = {
- 'isolateId': isolateId,
- 'frameIndex': 0,
- 'expression': expression,
- };
- Map<dynamic, dynamic> response = await request('evaluateInFrame', params);
-
- if (response.containsKey('error')) {
- return response['error']['data']['details'];
- } else {
- return response['result']['valueAsString'];
- }
- }
-}
diff --git a/tools/repl/pubspec.lock b/tools/repl/pubspec.lock
deleted file mode 100644
index bcb8866..0000000
--- a/tools/repl/pubspec.lock
+++ /dev/null
@@ -1,348 +0,0 @@
-# Generated by pub
-# See https://www.dartlang.org/tools/pub/glossary#lockfile
-packages:
- analyzer:
- dependency: transitive
- description:
- name: analyzer
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.32.5"
- args:
- dependency: transitive
- description:
- name: args
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.5.0"
- async:
- dependency: transitive
- description:
- name: async
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.8"
- boolean_selector:
- dependency: transitive
- description:
- name: boolean_selector
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.4"
- charcode:
- dependency: transitive
- description:
- name: charcode
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.2"
- collection:
- dependency: transitive
- description:
- name: collection
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.14.11"
- convert:
- dependency: transitive
- description:
- name: convert
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.2"
- crypto:
- dependency: transitive
- description:
- name: crypto
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.6"
- csslib:
- dependency: transitive
- description:
- name: csslib
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.14.5"
- front_end:
- dependency: transitive
- description:
- name: front_end
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.1.4+1"
- glob:
- dependency: transitive
- description:
- name: glob
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.7"
- html:
- dependency: transitive
- description:
- name: html
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.13.3+3"
- http:
- dependency: transitive
- description:
- name: http
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.12.0"
- http_multi_server:
- dependency: transitive
- description:
- name: http_multi_server
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.5"
- http_parser:
- dependency: transitive
- description:
- name: http_parser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.1.3"
- io:
- dependency: transitive
- description:
- name: io
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.3.3"
- js:
- dependency: transitive
- description:
- name: js
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.6.1+1"
- json_rpc_2:
- dependency: transitive
- description:
- name: json_rpc_2
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.9"
- kernel:
- dependency: transitive
- description:
- name: kernel
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.3.4+1"
- logging:
- dependency: transitive
- description:
- name: logging
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.11.3+2"
- matcher:
- dependency: transitive
- description:
- name: matcher
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.12.3+1"
- meta:
- dependency: transitive
- description:
- name: meta
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.6"
- mime:
- dependency: transitive
- description:
- name: mime
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.9.6+2"
- multi_server_socket:
- dependency: transitive
- description:
- name: multi_server_socket
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.2"
- node_preamble:
- dependency: transitive
- description:
- name: node_preamble
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.4.4"
- package_config:
- dependency: transitive
- description:
- name: package_config
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.5"
- package_resolver:
- dependency: transitive
- description:
- name: package_resolver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.6"
- path:
- dependency: transitive
- description:
- name: path
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.6.2"
- plugin:
- dependency: transitive
- description:
- name: plugin
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.2.0+3"
- pool:
- dependency: transitive
- description:
- name: pool
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.6"
- pub_semver:
- dependency: transitive
- description:
- name: pub_semver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.4.2"
- shelf:
- dependency: transitive
- description:
- name: shelf
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.7.3+3"
- shelf_packages_handler:
- dependency: transitive
- description:
- name: shelf_packages_handler
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.4"
- shelf_static:
- dependency: transitive
- description:
- name: shelf_static
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.2.8"
- shelf_web_socket:
- dependency: transitive
- description:
- name: shelf_web_socket
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.2.2+4"
- source_map_stack_trace:
- dependency: transitive
- description:
- name: source_map_stack_trace
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.5"
- source_maps:
- dependency: transitive
- description:
- name: source_maps
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.10.7"
- source_span:
- dependency: transitive
- description:
- name: source_span
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.4.1"
- stack_trace:
- dependency: transitive
- description:
- name: stack_trace
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.9.3"
- stream_channel:
- dependency: transitive
- description:
- name: stream_channel
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.6.8"
- string_scanner:
- dependency: transitive
- description:
- name: string_scanner
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.4"
- term_glyph:
- dependency: transitive
- description:
- name: term_glyph
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.1"
- test:
- dependency: "direct main"
- description:
- name: test
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.3"
- typed_data:
- dependency: transitive
- description:
- name: typed_data
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.6"
- utf:
- dependency: transitive
- description:
- name: utf
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.9.0+5"
- vm_service_client:
- dependency: transitive
- description:
- name: vm_service_client
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.2.6"
- watcher:
- dependency: transitive
- description:
- name: watcher
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.9.7+10"
- web_socket_channel:
- dependency: transitive
- description:
- name: web_socket_channel
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.9"
- yaml:
- dependency: transitive
- description:
- name: yaml
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.15"
-sdks:
- dart: ">=2.0.0 <3.0.0"
diff --git a/tools/repl/pubspec.yaml b/tools/repl/pubspec.yaml
deleted file mode 100644
index 7b61e02..0000000
--- a/tools/repl/pubspec.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-name: repl
-environment:
- sdk: '>=2.0.0 <3.0.0'
-dependencies:
- test: any
diff --git a/tools/repl/test/interact_test.dart b/tools/repl/test/interact_test.dart
deleted file mode 100644
index cb5c12c..0000000
--- a/tools/repl/test/interact_test.dart
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:async';
-import 'package:test/test.dart';
-
-import 'package:repl/interact.dart';
-
-void main() {
- const delete = '\u{7f}';
- const up = '\u{1b}[A';
- const down = '\u{1b}[B';
- const forward = '\u{1b}[C';
- const back = '\u{1b}[D';
-
- test('write and delete', () {
- expect(interact(Stream.fromIterable([
- '1', '2', '3',
- delete, delete, delete, delete,
- ])), emitsInOrder([
- [Output.prompt, '1', 1],
- [Output.prompt, '12', 2],
- [Output.prompt, '123', 3],
- [Output.prompt, '12', 2],
- [Output.prompt, '1', 1],
- [Output.prompt, '', 0],
- [Output.bell],
- ]));
- });
-
- test('delete from middle and check boundaries', () {
- expect(interact(Stream.fromIterable([
- '1', '2', '3',
- back, delete,
- back, back,
- forward, forward, forward,
- back,
- ])), emitsInOrder([
- [Output.prompt, '1', 1],
- [Output.prompt, '12', 2],
- [Output.prompt, '123', 3],
- [Output.prompt, '123', 2],
- [Output.prompt, '13', 1],
- [Output.prompt, '13', 0],
- [Output.bell],
- [Output.prompt, '13', 1],
- [Output.prompt, '13', 2],
- [Output.bell],
- [Output.prompt, '13', 1],
- ]));
- });
-
- test('history', () {
- expect(interact(Stream.fromIterable([
- '1', '\n', '2', '\n',
- up, up, up,
- down, down,
- back, '-', '\n',
- up, up,
- ])), emitsInOrder([
- [Output.prompt, '1', 1],
- [Output.evaluate, '1'],
- [Output.prompt, '2', 1],
- [Output.evaluate, '2'],
- [Output.prompt, '2', 1],
- [Output.prompt, '1', 1],
- [Output.bell],
- [Output.prompt, '2', 1],
- [Output.bell],
- [Output.prompt, '2', 0],
- [Output.prompt, '-2', 1],
- [Output.evaluate, '-2'],
- [Output.prompt, '-2', 2],
- [Output.prompt, '2', 1],
- ]));
- });
-
- test('unicode literal', () {
- expect(interact(Stream.fromIterable([
- '1', back, '🐙',
- ])), emitsInOrder([
- [Output.prompt, '1', 1],
- [Output.prompt, '1', 0],
- [Output.prompt, '\\u{1f419}1', 9],
- ]));
- });
-
- test('paste', () {
- expect(interact(Stream.fromIterable([
- '123',
- ])), emitsInOrder([
- [Output.prompt, '123', 3],
- ]));
- });
-
- test('multi-line paste', () {
- expect(interact(Stream.fromIterable([
- '1', '2\n34\n5',
- up, up,
- ])), emitsInOrder([
- [Output.prompt, '1', 1],
- [Output.evaluate, '12'],
- [Output.evaluate, '34'],
- [Output.prompt, '5', 1],
- [Output.prompt, '34', 2],
- [Output.prompt, '12', 2],
- ]));
- });
-}
diff --git a/tools/repl/test/remote_vm_e2e_test.dart b/tools/repl/test/remote_vm_e2e_test.dart
deleted file mode 100644
index 1e318fc..0000000
--- a/tools/repl/test/remote_vm_e2e_test.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:io';
-import 'package:test/test.dart';
-
-import 'package:repl/remote_vm.dart';
-
-void main(List<String> args) async {
- if (args.length != 1) {
- stderr.writeln(
- 'This test requires a single argument: the observatory port to use.');
- exitCode = 1;
- return;
- }
- var port = args[0];
- var dart = Platform.resolvedExecutable;
- var fakeMainPath = Platform.script.toString().replaceFirst(
- RegExp(r'test/remote_vm_e2e_test.dart$'), 'lib/fake_main.dart');
-
- Process fakeMain;
-
- setUp(() async {
- fakeMain = await Process.start(dart, ['--observe=$port', fakeMainPath]);
- });
-
- tearDown(() async {
- fakeMain.kill();
- await fakeMain.exitCode;
- });
-
- test('connect to VM and evaluate', () async {
- var vm = RemoteVm();
- await vm.connect('ws://127.0.0.1:$port/ws');
-
- expect(await vm.evaluate('triple(1)'), equals('3'));
- expect(await vm.evaluate('nope'), contains('Error:'));
- });
-}