<commit_before>// Copyright (c) 2015, 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.
// VMOptions=--compile-all --error_on_bad_type --error_on_bad_override

import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';

void test() {
  debugger();
  stdout.write('stdout');

  debugger();
  print('print');

  debugger();
  stderr.write('stderr');
}

var tests = [
  hasStoppedAtBreakpoint,

  (Isolate isolate) async {
    Completer completer = new Completer();
    var stdoutSub;
    stdoutSub = await isolate.vm.listenEventStream(
      VM.kStdoutStream,
      (ServiceEvent event) {
        expect(event.kind, equals('WriteEvent'));
        expect(event.bytesAsString, equals('stdout'));
        cancelFutureSubscription(stdoutSub).then((_) {
          completer.complete();
        });
      });
    await isolate.resume();
    await completer.future;
  },

  hasStoppedAtBreakpoint,

  (Isolate isolate) async {
    Completer completer = new Completer();
    var stdoutSub;
    int eventNumber = 1;
    stdoutSub = await isolate.vm.listenEventStream(
      VM.kStdoutStream,
      (ServiceEvent event) {
        expect(event.kind, equals('WriteEvent'));
        if (eventNumber == 1) {
          expect(event.bytesAsString, equals('print'));
        } else if (eventNumber == 2) {
          expect(event.bytesAsString, equals('\n'));
          cancelFutureSubscription(stdoutSub).then((_) {
            completer.complete();
          });
        } else {
          expect(true, false);
        }
        eventNumber++;
      });
    await isolate.resume();
    await completer.future;
  },

  hasStoppedAtBreakpoint,

  (Isolate isolate) async {
    Completer completer = new Completer();
    var stderrSub;
    stderrSub = await isolate.vm.listenEventStream(
      VM.kStderrStream,
      (ServiceEvent event) {
        expect(event.kind, equals('WriteEvent'));
        expect(event.bytesAsString, equals('stderr'));
        cancelFutureSubscription(stderrSub).then((_) {
          completer.complete();
        });
      });
    await isolate.resume();
    await completer.future;
  },
];

  
main(args) => runIsolateTests(args, tests, testeeConcurrent: test);<commit_msg>Fix problem when running new test in checked mode.<commit_after>// Copyright (c) 2015, 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.
// VMOptions=--compile-all --error_on_bad_type --error_on_bad_override

import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';

void test() {
  debugger();
  stdout.write('stdout');

  debugger();
  print('print');

  debugger();
  stderr.write('stderr');
}

var tests = [
  hasStoppedAtBreakpoint,

  (Isolate isolate) async {
    Completer completer = new Completer();
    var stdoutSub;
    stdoutSub = await isolate.vm.listenEventStream(
      VM.kStdoutStream,
      (ServiceEvent event) {
        expect(event.kind, equals('WriteEvent'));
        expect(event.bytesAsString, equals('stdout'));
        stdoutSub.cancel().then((_) {
          completer.complete();
        });
      });
    await isolate.resume();
    await completer.future;
  },

  hasStoppedAtBreakpoint,

  (Isolate isolate) async {
    Completer completer = new Completer();
    var stdoutSub;
    int eventNumber = 1;
    stdoutSub = await isolate.vm.listenEventStream(
      VM.kStdoutStream,
      (ServiceEvent event) {
        expect(event.kind, equals('WriteEvent'));
        if (eventNumber == 1) {
          expect(event.bytesAsString, equals('print'));
        } else if (eventNumber == 2) {
          expect(event.bytesAsString, equals('\n'));
          stdoutSub.cancel().then((_) {
            completer.complete();
          });
        } else {
          expect(true, false);
        }
        eventNumber++;
      });
    await isolate.resume();
    await completer.future;
  },

  hasStoppedAtBreakpoint,

  (Isolate isolate) async {
    Completer completer = new Completer();
    var stderrSub;
    stderrSub = await isolate.vm.listenEventStream(
      VM.kStderrStream,
      (ServiceEvent event) {
        expect(event.kind, equals('WriteEvent'));
        expect(event.bytesAsString, equals('stderr'));
        stderrSub.cancel().then((_) {
          completer.complete();
        });
      });
    await isolate.resume();
    await completer.future;
  },
];

  
main(args) => runIsolateTests(args, tests, testeeConcurrent: test);
{'fraction_non_alphanumeric': 0.1301313628899836, 'fraction_numerical': 0.0028735632183908046, 'mean_word_length': 2.920353982300885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '528608', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1461, 'n_words': 329}