<commit_before>// Copyright (c) 2013, Google Inc. 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 spark.ace_test;

import 'dart:async';
import 'dart:html';

import 'package:unittest/unittest.dart';

import '../lib/ace.dart';
import '../lib/navigation.dart';
import '../lib/outline.dart';
import '../lib/workspace.dart' as workspace;
import '../lib/ui/goto_line_view/goto_line_view.dart';
import '../lib/preferences.dart';

defineTests() {
  group('ace', () {
    // This essentially tests that the ace codebase is available.
    test('is available', () {
      expect(AceManager.available, true);
    });
  });
}

class MockAceManager implements AceManager {
  /// The element to put the editor in.
  final Element parentElement = null;
  workspace.File currentFile = null;
  AceManagerDelegate delegate = null;
  GotoLineView gotoLineView = null;
  Outline outline = null;

  MockAceManager();

  EditSession createEditSession(String text, String fileName) {
    return new MockEditSession(fileName);
  }

  Point get cursorPosition => new Point(0, 0);
  void set cursorPosition(Point position) {}
  void setSelectionAnchor(int row, int column) {}
  void selectTo(int row, int column) {}

  EditSession get currentSession => null;
  void focus() { }
  void resize() { }
  void setTheme(String theme) { }
  void switchTo(EditSession session, [workspace.File file]) { }
  set theme(String value) { }
  String get theme => null;
  Future<String> getKeyBinding() => new Future.value(null);
  void setKeyBinding(String name) { }
  num getFontSize() => null;
  void setFontSize(num size) { }
  void setMarkers(List<workspace.Marker> markers) { }
  void clearMarkers() { }
  void selectNextMarker() { }
  void selectPrevMarker() { }
  void createDialog(String filename) { }
  bool isFileExtensionEditable(String extension) => false;
  void buildOutline() { }
  Stream get onGotoDeclaration => null;
  NavigationLocation get navigationLocation => null;
  void setupOutline(Element parentElement) { }
}

class MockAceEditor implements TextEditor {
  AceManager aceManager;
  workspace.File file;

  MockAceEditor([this.aceManager]);

  Element get element => aceManager.parentElement;

  void activate() { }
  void resize() { }
  void focus() { }
  void deactivate() { }
  void reconcile() { }

  BoolCachedPreference get stripWhitespace => null;
  bool get dirty => false;

  set dirty(bool value) { }

  Stream get onDirtyChange => null;<commit_msg>Adding prepareForLinking to mock to remove warning.<commit_after>// Copyright (c) 2013, Google Inc. 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 spark.ace_test;

import 'dart:async';
import 'dart:html';

import 'package:unittest/unittest.dart';

import '../lib/ace.dart';
import '../lib/navigation.dart';
import '../lib/outline.dart';
import '../lib/workspace.dart' as workspace;
import '../lib/ui/goto_line_view/goto_line_view.dart';
import '../lib/preferences.dart';

defineTests() {
  group('ace', () {
    // This essentially tests that the ace codebase is available.
    test('is available', () {
      expect(AceManager.available, true);
    });
  });
}

class MockAceManager implements AceManager {
  /// The element to put the editor in.
  final Element parentElement = null;
  workspace.File currentFile = null;
  AceManagerDelegate delegate = null;
  GotoLineView gotoLineView = null;
  Outline outline = null;

  MockAceManager();

  EditSession createEditSession(String text, String fileName) {
    return new MockEditSession(fileName);
  }

  Point get cursorPosition => new Point(0, 0);
  void set cursorPosition(Point position) {}
  void setSelectionAnchor(int row, int column) {}
  void selectTo(int row, int column) {}

  EditSession get currentSession => null;
  void focus() { }
  void resize() { }
  void setTheme(String theme) { }
  void switchTo(EditSession session, [workspace.File file]) { }
  set theme(String value) { }
  String get theme => null;
  Future<String> getKeyBinding() => new Future.value(null);
  void setKeyBinding(String name) { }
  num getFontSize() => null;
  void setFontSize(num size) { }
  void setMarkers(List<workspace.Marker> markers) { }
  void clearMarkers() { }
  void selectNextMarker() { }
  void selectPrevMarker() { }
  void createDialog(String filename) { }
  bool isFileExtensionEditable(String extension) => false;
  void buildOutline() { }
  Stream get onGotoDeclaration => null;
  NavigationLocation get navigationLocation => null;
  void setupOutline(Element parentElement) { }
  Future prepareForLinking(workspace.Project project) => new Future.value();
}

class MockAceEditor implements TextEditor {
  AceManager aceManager;
  workspace.File file;

  MockAceEditor([this.aceManager]);

  Element get element => aceManager.parentElement;

  void activate() { }
  void resize() { }
  void focus() { }
  void deactivate() { }
  void reconcile() { }

  BoolCachedPreference get stripWhitespace => null;
  bool get dirty => false;

  set dirty(bool value) { }

  Stream get onDirtyChange => null;
{'fraction_non_alphanumeric': 0.11798287345385347, 'fraction_numerical': 0.002283539486203616, 'mean_word_length': 4.11284046692607, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 32, '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': '1973920', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1560, 'n_words': 472}