text:
var assert = require('assert');

module.exports = function() {};

module.exports.prototype = {

    configure: function(operators) {
        assert(Array.isArray(operators), 'requireOperatorBeforeLineBreak option requires array value');
        this._operatorIndex = {};
        for (var i = 0, l = operators.length; i < l; i++) {
            this._operatorIndex[operators[i]] = true;
        }
    },

    getOptionName: function () {
        return 'requireOperatorBeforeLineBreak';
    },

    check: function(file, errors) {
        var operators = this._operatorIndex;

        file.iterateTokensByType('Punctuator', function(token, i, tokens) {
            if (operators[token.value]) {
                var prevToken = tokens[i - 1];
                if (prevToken && prevToken.loc.end.line !== token.loc.start.line) {
                    errors.add(
                        'Operator ' + token.value + ' should not be on a new line',
                        token.loc.start
                    );
                }
            }
        });
    }

};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Chaetothyrium wormersleyi Hansf.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
from threading import Lock
import hashlib

# from .bitcoin import Hash, hash_encode
from .transaction import Transaction
from .util import ThreadJob, bh2u

class Synchronizer(ThreadJob):
    '''The synchronizer keeps the wallet up-to-date with its set of
    addresses and their transactions.  It subscribes over the network
    to wallet addresses, gets the wallet to generate new addresses
    when necessary, requests the transaction history of any addresses
    we don't have the full history of, and requests binary transaction
    data of any transactions the wallet doesn't have.

    External interface: __init__() and add() member functions.
    '''

    def __init__(self, wallet, network):
        self.wallet = wallet
        self.network = network
        self.new_addresses = set()
        # Entries are (tx_hash, tx_height) tuples
        self.requested_tx = {}
        self.requested_histories = {}
        self.requested_addrs = set()
        self.lock = Lock()

        self.initialized = False
        self.initialize()

    def parse_response(self, response):
        if response.get('error'):
            self.print_error("response error:", response)
            return None, None
        return response['params'], response['result']

    def is_up_to_date(self):
        return (not self.requested_tx and not self.requested_histories
                and not self.requested_addrs)

    def release(self):
        self.network.unsubscribe(self.on_address_status)

    def add(self, address):
        '''This can be called from the proxy or GUI threads.'''
        with self.lock:
            self.new_addresses.add(address)

    def subscribe_to_addresses(self, addresses):
        if addresses:
            self.requested_addrs |= addresses
            self.network.subscribe_to_addresses(addresses, self.on_address_status)

    def get_status(self, h):
        if not h:
            return None
        status = ''
        for tx_hash, height in h:
            status += tx_hash + ':%d:' % height
        return bh2u(hashlib.sha256(status.encode('ascii')).digest())

    def on_address_status(self, response):
        if self.wallet.synchronizer is None and self.initialized:
            return  # we have been killed, this was just an orphan callback
        params, result = self.parse_response(response)
        if not params:
            return
        addr = params[0]
        history = self.wallet.history.get(addr, [])
        if self.get_status(history) != result:
            if self.requested_histories.get(addr) is None:
                self.requested_histories[addr] = result
                self.network.request_address_history(addr, self.on_address_history)
        # remove addr from list only after it is added to requested_histories
        if addr in self.requested_addrs:  # Notifications won't be in
            self.requested_addrs.remove(addr)

    def on_address_history(self, response):
        if self.wallet.synchronizer is None and self.initialized:
            return  # we have been killed, this was just an orphan callback
        params, result = self.parse_response(response)
        if not params:
            return
        addr = params[0]
        server_status = self.requested_histories.get(addr)
        if server_status is None:
            self.print_error("receiving history (unsolicited)", addr, len(result))
            return
        self.print_error("receiving history", addr, len(result))
        hashes = set(map(lambda item: item['tx_hash'], result))
        hist = list(map(lambda item: (item['tx_hash'], item['height']), result))
        # tx_fees
        tx_fees = [(item['tx_hash'], item.get('fee')) for item in result]
        tx_fees = dict(filter(lambda x:x[1] is not None, tx_fees))
        # Note if the server hasn't been patched to sort the items properly
        if hist != sorted(hist, key=lambda x:x[1]):
            self.network.interface.print_error("serving improperly sorted address histories")
        # Check that txids are unique
        if len(hashes) != len(result):
            self.print_error("error: server history has non-unique txids: %s"% addr)
        # Check that the status corresponds to what was announced
        elif self.get_status(hist) != server_status:
            self.print_error("error: status mismatch: %s" % addr)
        else:
            # Store received history
            self.wallet.receive_history_callback(addr, hist, tx_fees)
            # Request transactions we don't have
            self.request_missing_txs(hist)
        # Remove request; this allows up_to_date to be True
        self.requested_histories.pop(addr)

    def on_tx_response(self, response):
        if self.wallet.synchronizer is None and self.initialized:
            return  # we have been killed, this was just an orphan callback
        params, result = self.parse_response(response)
        if not params:
            return
        tx_hash = params[0]
        #assert tx_hash == hash_encode(Hash(bytes.fromhex(result)))
        tx = Transaction(result)
        try:
            tx.deserialize()
        except Exception:
            self.print_msg("cannot deserialize transaction, skipping", tx_hash)
            return
        tx_height = self.requested_tx.pop(tx_hash)
        self.wallet.receive_tx_callback(tx_hash, tx, tx_height)
        self.print_error("received tx %s height: %d bytes: %d" %
                         (tx_hash, tx_height, len(tx.raw)))
        # callbacks
        self.network.trigger_callback('new_transaction', tx)
        if not self.requested_tx:
            self.network.trigger_callback('updated')

    def request_missing_txs(self, hist):
        # "hist" is a list of [tx_hash, tx_height] lists
        requests = []
        for tx_hash, tx_height in hist:
            if tx_hash in self.requested_tx:
                continue
            if tx_hash in self.wallet.transactions:
                continue
            requests.append(('blockchain.transaction.get', [tx_hash]))
            self.requested_tx[tx_hash] = tx_height
        self.network.send(requests, self.on_tx_response)

    def initialize(self):
        '''Check the initial state of the wallet.  Subscribe to all its
        addresses, and request any transactions in its address history
        we don't have.
        '''
        for history in self.wallet.history.values():
            # Old electrum servers returned ['*'] when all history for
            # the address was pruned.  This no longer happens but may
            # remain in old wallets.
            if history == ['*']:
                continue
            self.request_missing_txs(history)

        if self.requested_tx:
            self.print_error("missing tx", self.requested_tx)
        self.subscribe_to_addresses(set(self.wallet.get_addresses()))
        self.initialized = True

    def run(self):
        '''Called from the network proxy thread main loop.'''
        # 1. Create new addresses
        self.wallet.synchronize()

        # 2. Subscribe to new addresses
        with self.lock:
            addresses = self.new_addresses
            self.new_addresses = set()
        self.subscribe_to_addresses(addresses)

        # 3. Detect if situation has changed
        up_to_date = self.is_up_to_date()
        if up_to_date != self.wallet.is_up_to_date():
            self.wallet.set_up_to_date(up_to_date)
            self.network.trigger_callback('updated')


text:
.. _flask_velox.admin.mixins:

flask_velox.admin.mixins
========================

Extends the default mixins to work with ``Flask-Admin``.

.. seealso::

    * :ref:`flask_velox.mixins`

Modules
-------

.. toctree::
    :maxdepth: 1

    mixins/forms
    mixins/template
    mixins/sqla


text:
import { useEffect } from 'react'
import { firebaseCloudMessaging } from '../utils/webPush'

const Index = () => {
  useEffect(() => {
    firebaseCloudMessaging.init()
  }, [])

  return
Next.js with firebase cloud messaging.

}

export default Index


text:
import warning from 'warning'
import invariant from 'invariant'
import React, { Component } from 'react'
import { createRouteFromReactElement } from './RouteUtils'
import { component, components, falsy } from './PropTypes'

const { func } = React.PropTypes

/**
 * An <IndexRoute> is used to specify its parent's <Route indexRoute> in
 * a JSX route config.
 */
class IndexRoute extends Component {

  static createRouteFromReactElement(element, parentRoute) {
    /* istanbul ignore else: sanity check */
    if (parentRoute) {
      parentRoute.indexRoute = createRouteFromReactElement(element)
    } else {
      warning(
        false,
        'An <IndexRoute> does not make sense at the root of your route config'
      )
    }
  }

  static propTypes = {
    path: falsy,
    component,
    components,
    getComponent: func,
    getComponents: func
  }

  /* istanbul ignore next: sanity check */
  render() {
    invariant(
      false,
      '<IndexRoute> elements are for router configuration only and should not be rendered'
    )
  }

}

export default IndexRoute


text:
package com.google.ads.googleads.v10.enums;

public final class LeadFormDesiredIntentProto {
  private LeadFormDesiredIntentProto() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_ads_googleads_v10_enums_LeadFormDesiredIntentEnum_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_ads_googleads_v10_enums_LeadFormDesiredIntentEnum_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static  com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n=google/ads/googleads/v10/enums/lead_fo" +
      "rm_desired_intent.proto\022\036google.ads.goog" +
      "leads.v10.enums\"s\n\031LeadFormDesiredIntent" +
      "Enum\"V\n\025LeadFormDesiredIntent\022\017\n\013UNSPECI" +
      "FIED\020\000\022\013\n\007UNKNOWN\020\001\022\016\n\nLOW_INTENT\020\002\022\017\n\013H" +
      "IGH_INTENT\020\003B\364\001\n\"com.google.ads.googlead" +
      "s.v10.enumsB\032LeadFormDesiredIntentProtoP" +
      "\001ZCgoogle.golang.org/genproto/googleapis" +
      "/ads/googleads/v10/enums;enums\242\002\003GAA\252\002\036G" +
      "oogle.Ads.GoogleAds.V10.Enums\312\002\036Google\\A" +
      "ds\\GoogleAds\\V10\\Enums\352\002\"Google::Ads::Go" +
      "ogleAds::V10::Enumsb\006proto3"
    };
    descriptor = com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        });
    internal_static_google_ads_googleads_v10_enums_LeadFormDesiredIntentEnum_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_google_ads_googleads_v10_enums_LeadFormDesiredIntentEnum_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_ads_googleads_v10_enums_LeadFormDesiredIntentEnum_descriptor,
        new java.lang.String[] { });
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
package org.apache.nifi.web.api.dto;

import com.wordnik.swagger.annotations.ApiModelProperty;

import javax.xml.bind.annotation.XmlType;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Details for a processor within this NiFi.
 */
@XmlType(name = "processor")
public class ProcessorDTO extends ComponentDTO {

    private String name;
    private String type;
    private BundleDTO bundle;
    private String state;
    private Map<String, String> style;
    private List<RelationshipDTO> relationships;
    private String description;
    private Boolean supportsParallelProcessing;
    private Boolean supportsEventDriven;
    private Boolean supportsBatching;
    private Boolean persistsState;
    private Boolean restricted;
    private Boolean isExtensionMissing;
    private Boolean multipleVersionsAvailable;
    private String inputRequirement;

    private ProcessorConfigDTO config;

    private Collection<String> validationErrors;

    public ProcessorDTO() {
        super();
    }

    /**
     * The name of this processor.
     *
     * @return This processors name
     */
    @ApiModelProperty(
            value = "The name of the processor."
    )
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * The type of this processor.
     *
     * @return This processors type
     */
    @ApiModelProperty(
            value = "The type of the processor."
    )
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    /**
     * The details of the artifact that bundled this processor type.
     *
     * @return The bundle details
     */
    @ApiModelProperty(
            value = "The details of the artifact that bundled this processor type."
    )
    public BundleDTO getBundle() {
        return bundle;
    }

    public void setBundle(BundleDTO bundle) {
        this.bundle = bundle;
    }

    /**
     * @return The state of this processor. Possible states are 'RUNNING', 'STOPPED', and 'DISABLED'
     */
    @ApiModelProperty(
            value = "The state of the processor",
            allowableValues = "RUNNING, STOPPED, DISABLED"
    )
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    /**
     * @return The styles for this processor. (Currently only supports color)
     */
    @ApiModelProperty(
            value = "Styles for the processor (background-color => #eee)."
    )
    public Map<String, String> getStyle() {
        return style;
    }

    public void setStyle(Map<String, String> style) {
        this.style = style;
    }

    /**
     * @return whether this processor supports parallel processing
     */
    @ApiModelProperty(
            value = "Whether the processor supports parallel processing."
    )
    public Boolean getSupportsParallelProcessing() {
        return supportsParallelProcessing;
    }

    public void setSupportsParallelProcessing(Boolean supportsParallelProcessing) {
        this.supportsParallelProcessing = supportsParallelProcessing;
    }

    /**
     * @return whether this processor persists state
     */
    @ApiModelProperty(
        value = "Whether the processor persists state."
    )
    public Boolean getPersistsState() {
        return persistsState;
    }

    public void setPersistsState(Boolean persistsState) {
        this.persistsState = persistsState;
    }

    /**
     * @return whether this processor has multiple versions available
     */
    @ApiModelProperty(
            value = "Whether the processor has multiple versions available."
    )
    public Boolean getMultipleVersionsAvailable() {
        return multipleVersionsAvailable;
    }

    public void setMultipleVersionsAvailable(Boolean multipleVersionsAvailable) {
        this.multipleVersionsAvailable = multipleVersionsAvailable;
    }

    /**
     * @return whether the underlying extension is missing
     */
    @ApiModelProperty(
            value = "Whether the underlying extension is missing."
    )
    public Boolean getExtensionMissing() {
        return isExtensionMissing;
    }

    public void setExtensionMissing(Boolean extensionMissing) {
        isExtensionMissing = extensionMissing;
    }

    /**
     * @return whether this processor requires elevated privileges
     */
    @ApiModelProperty(
            value = "Whether the processor requires elevated privileges."
    )
    public Boolean getRestricted() {
        return restricted;
    }

    public void setRestricted(Boolean restricted) {
        this.restricted = restricted;
    }

    /**
     * @return the input requirement of this processor
     */
    @ApiModelProperty(
            value = "The input requirement for this processor."
    )
    public String getInputRequirement() {
        return inputRequirement;
    }

    public void setInputRequirement(String inputRequirement) {
        this.inputRequirement = inputRequirement;
    }

    /**
     * @return whether this processor supports event driven scheduling
     */
    @ApiModelProperty(
            value = "Whether the processor supports event driven scheduling."
    )
    public Boolean getSupportsEventDriven() {
        return supportsEventDriven;
    }

    public void setSupportsEventDriven(Boolean supportsEventDriven) {
        this.supportsEventDriven = supportsEventDriven;
    }

    /**
     * @return whether this processor supports batching
     */
    @ApiModelProperty(
        value = "Whether the processor supports batching. This makes the run duration settings available."
    )
    public Boolean getSupportsBatching() {
        return supportsBatching;
    }

    public void setSupportsBatching(Boolean supportsBatching) {
        this.supportsBatching = supportsBatching;
    }

    /**
     * Gets the available relationships that this processor currently supports.
     *
     * @return The available relationships
     */
    @ApiModelProperty(
            value = "The available relationships that the processor currently supports.",
            readOnly = true
    )
    public List<RelationshipDTO> getRelationships() {
        return relationships;
    }

    public void setRelationships(List<RelationshipDTO> relationships) {
        this.relationships = relationships;
    }

    /**
     * The configuration details for this processor. These details will be included in a response if the verbose flag is set to true.
     *
     * @return The processor configuration details
     */
    @ApiModelProperty(
            value = "The configuration details for the processor. These details will be included in a response if the verbose flag is included in a request."
    )
    public ProcessorConfigDTO getConfig() {
        return config;
    }

    public void setConfig(ProcessorConfigDTO config) {
        this.config = config;
    }

    /**
     * Gets the validation errors from this processor. These validation errors represent the problems with the processor that must be resolved before it can be started.
     *
     * @return The validation errors
     */
    @ApiModelProperty(
            value = "The validation errors for the processor. These validation errors represent the problems with the processor that must be resolved before it can be started."
    )
    public Collection<String> getValidationErrors() {
        return validationErrors;
    }

    public void setValidationErrors(Collection<String> validationErrors) {
        this.validationErrors = validationErrors;
    }

    /**
     * @return the description for this processor
     */
    @ApiModelProperty(
            value = "The description of the processor."
    )
    public String getDescription() {
        return description;
    }

    public void setDescription(final String description) {
        this.description = description;
    }

}


text:
#include <aws/sms/model/ServerGroupLaunchConfiguration.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace SMS
{
namespace Model
{

ServerGroupLaunchConfiguration::ServerGroupLaunchConfiguration() :
    m_serverGroupIdHasBeenSet(false),
    m_launchOrder(0),
    m_launchOrderHasBeenSet(false),
    m_serverLaunchConfigurationsHasBeenSet(false)
{
}

ServerGroupLaunchConfiguration::ServerGroupLaunchConfiguration(JsonView jsonValue) :
    m_serverGroupIdHasBeenSet(false),
    m_launchOrder(0),
    m_launchOrderHasBeenSet(false),
    m_serverLaunchConfigurationsHasBeenSet(false)
{
  *this = jsonValue;
}

ServerGroupLaunchConfiguration& ServerGroupLaunchConfiguration::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("serverGroupId"))
  {
    m_serverGroupId = jsonValue.GetString("serverGroupId");

    m_serverGroupIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("launchOrder"))
  {
    m_launchOrder = jsonValue.GetInteger("launchOrder");

    m_launchOrderHasBeenSet = true;
  }

  if(jsonValue.ValueExists("serverLaunchConfigurations"))
  {
    Aws::Utils::Array<JsonView> serverLaunchConfigurationsJsonList = jsonValue.GetArray("serverLaunchConfigurations");
    for(unsigned serverLaunchConfigurationsIndex = 0; serverLaunchConfigurationsIndex < serverLaunchConfigurationsJsonList.GetLength(); ++serverLaunchConfigurationsIndex)
    {
      m_serverLaunchConfigurations.push_back(serverLaunchConfigurationsJsonList[serverLaunchConfigurationsIndex].AsObject());
    }
    m_serverLaunchConfigurationsHasBeenSet = true;
  }

  return *this;
}

JsonValue ServerGroupLaunchConfiguration::Jsonize() const
{
  JsonValue payload;

  if(m_serverGroupIdHasBeenSet)
  {
   payload.WithString("serverGroupId", m_serverGroupId);

  }

  if(m_launchOrderHasBeenSet)
  {
   payload.WithInteger("launchOrder", m_launchOrder);

  }

  if(m_serverLaunchConfigurationsHasBeenSet)
  {
   Aws::Utils::Array<JsonValue> serverLaunchConfigurationsJsonList(m_serverLaunchConfigurations.size());
   for(unsigned serverLaunchConfigurationsIndex = 0; serverLaunchConfigurationsIndex < serverLaunchConfigurationsJsonList.GetLength(); ++serverLaunchConfigurationsIndex)
   {
     serverLaunchConfigurationsJsonList[serverLaunchConfigurationsIndex].AsObject(m_serverLaunchConfigurations[serverLaunchConfigurationsIndex].Jsonize());
   }
   payload.WithArray("serverLaunchConfigurations", std::move(serverLaunchConfigurationsJsonList));

  }

  return payload;
}

} // namespace Model
} // namespace SMS
} // namespace Aws


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;

using AM.Runtime;

using ManagedIrbis;
using ManagedIrbis.Fields;

namespace UnitTests.ManagedIrbis.Fields
{
    [TestClass]
    public class RevisionInfoTest
    {
        [TestMethod]
        public void RevisionInfo_Constructor_1()
        {
            RevisionInfo revision = new RevisionInfo();
            Assert.IsNull(revision.Stage);
            Assert.IsNull(revision.Date);
            Assert.IsNull(revision.Name);
            Assert.IsNull(revision.UnknownSubFields);
            Assert.IsNull(revision.Field);
            Assert.IsNull(revision.UserData);
        }

        private void _TestSerialization
            (
                RevisionInfo first
            )
        {
            byte[] bytes = first.SaveToMemory();

            RevisionInfo second = bytes
                    .RestoreObjectFromMemory<RevisionInfo>();
            Assert.AreEqual(first.Date, second.Date);
            Assert.AreEqual(first.Name, second.Name);
            Assert.AreEqual(first.Stage, second.Stage);
            Assert.AreSame(first.UnknownSubFields, second.UnknownSubFields);
            Assert.IsNull(second.UserData);
        }

        [TestMethod]
        public void RevisionInfo_Serialization_1()
        {
            var revision = new RevisionInfo();
            _TestSerialization(revision);

            revision.UserData = "User data";
            revision.Field = new RecordField();
            _TestSerialization(revision);

            revision = new RevisionInfo
            {
                Date = "20051010",
                Name = "ТНП",
                Stage = "ПК"
            };
            _TestSerialization(revision);
        }

        private MarcRecord _GetRecord()
        {
            MarcRecord result = new MarcRecord();
            result.Fields.Add(new RecordField("907", "^CПК^A20051010^BТНП^101"));
            result.Fields.Add(new RecordField("907", "^CКР^A20051108^BАЕВ^101"));
            result.Fields.Add(new RecordField("907", "^C^A20130127^B"));
            result.Fields.Add(new RecordField("907", "^CКР^A20160516^Bреутовасс"));
            result.Fields.Add(new RecordField("907", "^CКР^A20160823^Bсуханованн"));

            return result;
        }

        [TestMethod]
        public void RevisionInfo_Parse_1()
        {
            MarcRecord record = _GetRecord();
            RevisionInfo[] actual = RevisionInfo.Parse(record);
            Assert.AreEqual(5, actual.Length);
            Assert.AreEqual("20051010", actual[0].Date);
            Assert.AreEqual("ТНП", actual[0].Name);
            Assert.AreEqual("ПК", actual[0].Stage);
        }

        [TestMethod]
        public void RevisionInfo_ToField_1()
        {
            RevisionInfo revision = new RevisionInfo
            {
                Date = "20051010",
                Name = "ТНП",
                Stage = "ПК"
            };
            RecordField actual = revision.ToField();
            Assert.AreEqual("20051010", actual.GetFirstSubFieldValue('a'));
            Assert.AreEqual("ТНП", actual.GetFirstSubFieldValue('b'));
            Assert.AreEqual("ПК", actual.GetFirstSubFieldValue('c'));
        }

        [TestMethod]
        public void RevisionInfo_ToString_1()
        {
            RevisionInfo revision = new RevisionInfo
            {
                Date = "20051010",
                Name = "ТНП",
                Stage = "ПК"
            };
            const string expected = "Stage: ПК, Date: 20051010, Name: ТНП";
            string actual = revision.ToString();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void RevisionInfo_ApplyToField_1()
        {
            RecordField field = new RecordField(RevisionInfo.Tag)
                .AddSubField('a', "----")
                .AddSubField('b', "???");
            RevisionInfo revision = new RevisionInfo
            {
                Date = "20051010",
                Name = "ТНП",
                Stage = "ПК"
            };
            revision.ApplyToField(field);
            Assert.AreEqual("20051010", field.GetFirstSubFieldValue('a'));
            Assert.AreEqual("ТНП", field.GetFirstSubFieldValue('b'));
            Assert.AreEqual("ПК", field.GetFirstSubFieldValue('c'));
        }
    }
}


text:
package com.thebluealliance.androidclient.helpers;

/**
 * Helper class used to verify team keys.
 *
 * @author Phil Lopreiato
 * @author Bryce Matsuda
 *

 *         File created by phil on 6/15/14.
 */
public class TeamHelper {
    /**
     * Checks if a team key is valid.
     *
     * @param key the team key to check
     * @return true if key is valid
     */
    public static boolean validateTeamKey(String key) {
        return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}$");
    }

    /**
     * Checks if a multi-team key is valid.
     *

     * In this context, a multi-team key is for a team that has two or more robots competing,
     * usually in an offseason event, and thus needs one (and ONLY one) extra letter attached to the
     * end to differentiate one from the others (e.g. 904 & 904B, 1973 & 1973D)
     *
     * @param key the team key to check
     * @return true if key is valid
     */
    public static boolean validateMultiTeamKey(String key) {
        return !(key == null || key.isEmpty()) && key.matches("^frc\\d{1,4}[a-zA-Z]$");
    }
}


text:
/// <reference path="..\harness.ts" />
/// <reference path="..\..\harness\harnessLanguageService.ts" />

namespace ts {

    const enum ChangedPart {
        references = 1 << 0,
        importsAndExports = 1 << 1,
        program = 1 << 2
    }

    const newLine = "\r\n";

    interface SourceFileWithText extends SourceFile {
        sourceText?: SourceText;
    }

    export interface NamedSourceText {
        name: string;
        text: SourceText;
    }

    export interface ProgramWithSourceTexts extends Program {
        sourceTexts?: ReadonlyArray<NamedSourceText>;
        host: TestCompilerHost;
    }

    interface TestCompilerHost extends CompilerHost {
        getTrace(): string[];
    }

    export class SourceText implements IScriptSnapshot {
        private fullText: string;

        constructor(private references: string,
            private importsAndExports: string,
            private program: string,
            private changedPart: ChangedPart = 0,
            private version = 0) {
        }

        static New(references: string, importsAndExports: string, program: string): SourceText {
            Debug.assert(references !== undefined);
            Debug.assert(importsAndExports !== undefined);
            Debug.assert(program !== undefined);
            return new SourceText(references + newLine, importsAndExports + newLine, program || "");
        }

        public getVersion(): number {
            return this.version;
        }

        public updateReferences(newReferences: string): SourceText {
            Debug.assert(newReferences !== undefined);
            return new SourceText(newReferences + newLine, this.importsAndExports, this.program, this.changedPart | ChangedPart.references, this.version + 1);
        }
        public updateImportsAndExports(newImportsAndExports: string): SourceText {
            Debug.assert(newImportsAndExports !== undefined);
            return new SourceText(this.references, newImportsAndExports + newLine, this.program, this.changedPart | ChangedPart.importsAndExports, this.version + 1);
        }
        public updateProgram(newProgram: string): SourceText {
            Debug.assert(newProgram !== undefined);
            return new SourceText(this.references, this.importsAndExports, newProgram, this.changedPart | ChangedPart.program, this.version + 1);
        }

        public getFullText() {
            return this.fullText || (this.fullText = this.references + this.importsAndExports + this.program);
        }

        public getText(start: number, end: number): string {
            return this.getFullText().substring(start, end);
        }

        getLength(): number {
            return this.getFullText().length;
        }

        getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange {
            const oldText = <SourceText>oldSnapshot;
            let oldSpan: TextSpan;
            let newLength: number;
            switch (oldText.changedPart ^ this.changedPart) {
                case ChangedPart.references:
                    oldSpan = createTextSpan(0, oldText.references.length);
                    newLength = this.references.length;
                    break;
                case ChangedPart.importsAndExports:
                    oldSpan = createTextSpan(oldText.references.length, oldText.importsAndExports.length);
                    newLength = this.importsAndExports.length;
                    break;
                case ChangedPart.program:
                    oldSpan = createTextSpan(oldText.references.length + oldText.importsAndExports.length, oldText.program.length);
                    newLength = this.program.length;
                    break;
                default:
                    Debug.assert(false, "Unexpected change");
            }

            return createTextChangeRange(oldSpan, newLength);
        }
    }

    function createSourceFileWithText(fileName: string, sourceText: SourceText, target: ScriptTarget) {
        const file = <SourceFileWithText>createSourceFile(fileName, sourceText.getFullText(), target);
        file.sourceText = sourceText;
        file.version = "" + sourceText.getVersion();
        return file;
    }

    export function createTestCompilerHost(texts: ReadonlyArray<NamedSourceText>, target: ScriptTarget, oldProgram?: ProgramWithSourceTexts): TestCompilerHost {
        const files = arrayToMap(texts, t => t.name, t => {
            if (oldProgram) {
                let oldFile = <SourceFileWithText>oldProgram.getSourceFile(t.name);
                if (oldFile && oldFile.redirectInfo) {
                    oldFile = oldFile.redirectInfo.unredirected;
                }
                if (oldFile && oldFile.sourceText.getVersion() === t.text.getVersion()) {
                    return oldFile;
                }
            }
            return createSourceFileWithText(t.name, t.text, target);
        });
        const trace: string[] = [];

        return {
            trace: s => trace.push(s),
            getTrace: () => trace,
            getSourceFile(fileName): SourceFile {
                return files.get(fileName);
            },
            getDefaultLibFileName(): string {
                return "lib.d.ts";
            },
            writeFile: notImplemented,
            getCurrentDirectory(): string {
                return "";
            },
            getDirectories(): string[] {
                return [];
            },
            getCanonicalFileName(fileName): string {
                return sys && sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
            },
            useCaseSensitiveFileNames(): boolean {
                return sys && sys.useCaseSensitiveFileNames;
            },
            getNewLine(): string {
                return sys ? sys.newLine : newLine;
            },
            fileExists: fileName => files.has(fileName),
            readFile: fileName => {
                const file = files.get(fileName);
                return file && file.text;
            },
        };
    }

    export function newProgram(texts: NamedSourceText[], rootNames: string[], options: CompilerOptions): ProgramWithSourceTexts {
        const host = createTestCompilerHost(texts, options.target);
        const program = <ProgramWithSourceTexts>createProgram(rootNames, options, host);
        program.sourceTexts = texts;
        program.host = host;
        return program;
    }

    export function updateProgram(oldProgram: ProgramWithSourceTexts, rootNames: ReadonlyArray<string>, options: CompilerOptions, updater: (files: NamedSourceText[]) => void, newTexts?: NamedSourceText[]) {
        if (!newTexts) {
            newTexts = (<ProgramWithSourceTexts>oldProgram).sourceTexts.slice(0);
        }
        updater(newTexts);
        const host = createTestCompilerHost(newTexts, options.target, oldProgram);
        const program = <ProgramWithSourceTexts>createProgram(rootNames, options, host, oldProgram);
        program.sourceTexts = newTexts;
        program.host = host;
        return program;
    }

    export function updateProgramText(files: ReadonlyArray<NamedSourceText>, fileName: string, newProgramText: string) {
        const file = find(files, f => f.name === fileName)!;
        file.text = file.text.updateProgram(newProgramText);
    }

    function checkResolvedTypeDirective(expected: ResolvedTypeReferenceDirective, actual: ResolvedTypeReferenceDirective): boolean {
        if (!expected === !actual) {
            if (expected) {
                assert.equal(expected.resolvedFileName, actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`);
                assert.equal(expected.primary, actual.primary, `'primary': expected '${expected.primary}' to be equal to '${actual.primary}'`);
            }
            return true;
        }
        return false;
    }

    function checkCache<T>(caption: string, program: Program, fileName: string, expectedContent: Map<T>, getCache: (f: SourceFile) => Map<T>, entryChecker: (expected: T, original: T) => boolean): void {
        const file = program.getSourceFile(fileName);
        assert.isTrue(file !== undefined, `cannot find file ${fileName}`);
        const cache = getCache(file);
        if (expectedContent === undefined) {
            assert.isTrue(cache === undefined, `expected ${caption} to be undefined`);
        }
        else {
            assert.isTrue(cache !== undefined, `expected ${caption} to be set`);
            assert.isTrue(mapsAreEqual(expectedContent, cache, entryChecker), `contents of ${caption} did not match the expected contents.`);
        }
    }

    /** True if the maps have the same keys and values. */
    function mapsAreEqual<T>(left: Map<T>, right: Map<T>, valuesAreEqual?: (left: T, right: T) => boolean): boolean {
        if (left === right) return true;
        if (!left || !right) return false;
        const someInLeftHasNoMatch = forEachEntry(left, (leftValue, leftKey) => {
            if (!right.has(leftKey)) return true;
            const rightValue = right.get(leftKey);
            return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue);
        });
        if (someInLeftHasNoMatch) return false;
        const someInRightHasNoMatch = forEachKey(right, rightKey => !left.has(rightKey));
        return !someInRightHasNoMatch;
    }

    function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map<ResolvedModule>): void {
        checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, checkResolvedModule);
    }

    function checkResolvedTypeDirectivesCache(program: Program, fileName: string, expectedContent: Map<ResolvedTypeReferenceDirective>): void {
        checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
    }

    describe("Reuse program structure", () => {
        const target = ScriptTarget.Latest;
        const files: NamedSourceText[] = [
            {
                name: "a.ts", text: SourceText.New(
                    `
/// <reference path='b.ts'/>
/// <reference path='non-existing-file.ts'/>
/// <reference types="typerefs" />
`, "", `var x = 1`)
            },
            { name: "b.ts", text: SourceText.New(`/// <reference path='c.ts'/>`, "", `var y = 2`) },
            { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) },
            { name: "types/typerefs/index.d.ts", text: SourceText.New("", "", `declare let z: number;`) },
        ];

        it("successful if change does not affect imports", () => {
            const program_1 = newProgram(files, ["a.ts"], { target });
            const program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
                files[0].text = files[0].text.updateProgram("var x = 100");
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.Completely);
            const program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts"));
            const program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts"));
            assert.equal(program1Diagnostics.length, program2Diagnostics.length);
        });

        it("successful if change does not affect type reference directives", () => {
            const program_1 = newProgram(files, ["a.ts"], { target });
            const program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
                files[0].text = files[0].text.updateProgram("var x = 100");
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.Completely);
            const program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts"));
            const program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts"));
            assert.equal(program1Diagnostics.length, program2Diagnostics.length);
        });

        it("fails if change affects tripleslash references", () => {
            const program_1 = newProgram(files, ["a.ts"], { target });
            updateProgram(program_1, ["a.ts"], { target }, files => {
                const newReferences = `/// <reference path='b.ts'/>
                /// <reference path='c.ts'/>
                `;
                files[0].text = files[0].text.updateReferences(newReferences);
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.SafeModules);
        });

        it("fails if change affects type references", () => {
            const program_1 = newProgram(files, ["a.ts"], { types: ["a"] });
            updateProgram(program_1, ["a.ts"], { types: ["b"] }, noop);
            assert.equal(program_1.structureIsReused, StructureIsReused.Not);
        });

        it("succeeds if change doesn't affect type references", () => {
            const program_1 = newProgram(files, ["a.ts"], { types: ["a"] });
            updateProgram(program_1, ["a.ts"], { types: ["a"] }, noop);
            assert.equal(program_1.structureIsReused, StructureIsReused.Completely);
        });

        it("fails if change affects imports", () => {
            const program_1 = newProgram(files, ["a.ts"], { target });
            updateProgram(program_1, ["a.ts"], { target }, files => {
                files[2].text = files[2].text.updateImportsAndExports("import x from 'b'");
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.SafeModules);
        });

        it("fails if change affects type directives", () => {
            const program_1 = newProgram(files, ["a.ts"], { target });
            updateProgram(program_1, ["a.ts"], { target }, files => {
                const newReferences = `
/// <reference path='b.ts'/>
/// <reference path='non-existing-file.ts'/>
/// <reference types="typerefs1" />`;
                files[0].text = files[0].text.updateReferences(newReferences);
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.SafeModules);
        });

        it("fails if module kind changes", () => {
            const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS });
            updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, noop);
            assert.equal(program_1.structureIsReused, StructureIsReused.Not);
        });

        it("fails if rootdir changes", () => {
            const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" });
            updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, noop);
            assert.equal(program_1.structureIsReused, StructureIsReused.Not);
        });

        it("fails if config path changes", () => {
            const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" });
            updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, noop);
            assert.equal(program_1.structureIsReused, StructureIsReused.Not);
        });

        it("succeeds if missing files remain missing", () => {
            const options: CompilerOptions = { target, noLib: true };

            const program_1 = newProgram(files, ["a.ts"], options);
            assert.notDeepEqual(emptyArray, program_1.getMissingFilePaths());

            const program_2 = updateProgram(program_1, ["a.ts"], options, noop);
            assert.deepEqual(program_1.getMissingFilePaths(), program_2.getMissingFilePaths());

            assert.equal(StructureIsReused.Completely, program_1.structureIsReused);
        });

        it("fails if missing file is created", () => {
            const options: CompilerOptions = { target, noLib: true };

            const program_1 = newProgram(files, ["a.ts"], options);
            assert.notDeepEqual(emptyArray, program_1.getMissingFilePaths());

            const newTexts: NamedSourceText[] = files.concat([{ name: "non-existing-file.ts", text: SourceText.New("", "", `var x = 1`) }]);
            const program_2 = updateProgram(program_1, ["a.ts"], options, noop, newTexts);
            assert.deepEqual(emptyArray, program_2.getMissingFilePaths());

            assert.equal(StructureIsReused.Not, program_1.structureIsReused);
        });

        it("resolution cache follows imports", () => {
            (<any>Error).stackTraceLimit = Infinity;

            const files = [
                { name: "a.ts", text: SourceText.New("", "import {_} from 'b'", "var x = 1") },
                { name: "b.ts", text: SourceText.New("", "", "var y = 2") },
            ];
            const options: CompilerOptions = { target };

            const program_1 = newProgram(files, ["a.ts"], options);
            checkResolvedModulesCache(program_1, "a.ts", createMapFromTemplate({ "b": createResolvedModule("b.ts") }));
            checkResolvedModulesCache(program_1, "b.ts", /*expectedContent*/ undefined);

            const program_2 = updateProgram(program_1, ["a.ts"], options, files => {
                files[0].text = files[0].text.updateProgram("var x = 2");
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.Completely);

            // content of resolution cache should not change
            checkResolvedModulesCache(program_1, "a.ts", createMapFromTemplate({ "b": createResolvedModule("b.ts") }));
            checkResolvedModulesCache(program_1, "b.ts", /*expectedContent*/ undefined);

            // imports has changed - program is not reused
            const program_3 = updateProgram(program_2, ["a.ts"], options, files => {
                files[0].text = files[0].text.updateImportsAndExports("");
            });
            assert.equal(program_2.structureIsReused, StructureIsReused.SafeModules);
            checkResolvedModulesCache(program_3, "a.ts", /*expectedContent*/ undefined);

            const program_4 = updateProgram(program_3, ["a.ts"], options, files => {
                const newImports = `import x from 'b'
                import y from 'c'
                `;
                files[0].text = files[0].text.updateImportsAndExports(newImports);
            });
            assert.equal(program_3.structureIsReused, StructureIsReused.SafeModules);
            checkResolvedModulesCache(program_4, "a.ts", createMapFromTemplate({ "b": createResolvedModule("b.ts"), "c": undefined }));
        });

        it("resolved type directives cache follows type directives", () => {
            const files = [
                { name: "/a.ts", text: SourceText.New("/// <reference types='typedefs'/>", "", "var x = $") },
                { name: "/types/typedefs/index.d.ts", text: SourceText.New("", "", "declare var $: number") },
            ];
            const options: CompilerOptions = { target, typeRoots: ["/types"] };

            const program_1 = newProgram(files, ["/a.ts"], options);
            checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMapFromTemplate({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }));
            checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", /*expectedContent*/ undefined);

            const program_2 = updateProgram(program_1, ["/a.ts"], options, files => {
                files[0].text = files[0].text.updateProgram("var x = 2");
            });
            assert.equal(program_1.structureIsReused, StructureIsReused.Completely);

            // content of resolution cache should not change
            checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMapFromTemplate({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }));
            checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", /*expectedContent*/ undefined);

            // type reference directives has changed - program is not reused
            const program_3 = updateProgram(program_2, ["/a.ts"], options, files => {
                files[0].text = files[0].text.updateReferences("");
            });

            assert.equal(program_2.structureIsReused, StructureIsReused.SafeModules);
            checkResolvedTypeDirectivesCache(program_3, "/a.ts", /*expectedContent*/ undefined);

            updateProgram(program_3, ["/a.ts"], options, files => {
                const newReferences = `/// <reference types="typedefs"/>
                /// <reference types="typedefs2"/>
                `;
                files[0].text = files[0].text.updateReferences(newReferences);
            });
            assert.equal(program_3.structureIsReused, StructureIsReused.SafeModules);
            checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMapFromTemplate({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }));
        });

        it("fetches imports after npm install", () => {
            const file1Ts = { name: "file1.ts", text: SourceText.New("", `import * as a from "a";`, "const myX: number = a.x;") };
            const file2Ts = { name: "file2.ts", text: SourceText.New("", "", "") };
            const indexDTS = { name: "node_modules/a/index.d.ts", text: SourceText.New("", "export declare let x: number;", "") };
            const options: CompilerOptions = { target: ScriptTarget.ES2015, traceResolution: true, moduleResolution: ModuleResolutionKind.NodeJs };
            const rootFiles = [file1Ts, file2Ts];
            const filesAfterNpmInstall = [file1Ts, file2Ts, indexDTS];

            const initialProgram = newProgram(rootFiles, rootFiles.map(f => f.name), options);
            {
                assert.deepEqual(initialProgram.host.getTrace(),
                    [
                        "======== Resolving module 'a' from 'file1.ts'. ========",
                        "Explicitly specified module resolution kind: 'NodeJs'.",
                        "Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'.",
                        "File 'node_modules/a/package.json' does not exist.",
                        "File 'node_modules/a.ts' does not exist.",
                        "File 'node_modules/a.tsx' does not exist.",
                        "File 'node_modules/a.d.ts' does not exist.",
                        "File 'node_modules/a/index.ts' does not exist.",
                        "File 'node_modules/a/index.tsx' does not exist.",
                        "File 'node_modules/a/index.d.ts' does not exist.",
                        "File 'node_modules/@types/a/package.json' does not exist.",
                        "File 'node_modules/@types/a.d.ts' does not exist.",
                        "File 'node_modules/@types/a/index.d.ts' does not exist.",
                        "Loading module 'a' from 'node_modules' folder, target file type 'JavaScript'.",
                        "File 'node_modules/a/package.json' does not exist.",
                        "File 'node_modules/a.js' does not exist.",
                        "File 'node_modules/a.jsx' does not exist.",
                        "File 'node_modules/a/index.js' does not exist.",
                        "File 'node_modules/a/index.jsx' does not exist.",
                        "======== Module name 'a' was not resolved. ========"
                    ],
                    "initialProgram: execute module resolution normally.");

                const initialProgramDiagnostics = initialProgram.getSemanticDiagnostics(initialProgram.getSourceFile("file1.ts"));
                assert.lengthOf(initialProgramDiagnostics, 1, `initialProgram: import should fail.`);
            }

            const afterNpmInstallProgram = updateProgram(initialProgram, rootFiles.map(f => f.name), options, f => {
                f[1].text = f[1].text.updateReferences(`/// <reference no-default-lib="true"/>`);
            }, filesAfterNpmInstall);
            {
                assert.deepEqual(afterNpmInstallProgram.host.getTrace(),
                    [
                        "======== Resolving module 'a' from 'file1.ts'. ========",
                        "Explicitly specified module resolution kind: 'NodeJs'.",
                        "Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'.",
                        "File 'node_modules/a/package.json' does not exist.",
                        "File 'node_modules/a.ts' does not exist.",
                        "File 'node_modules/a.tsx' does not exist.",
                        "File 'node_modules/a.d.ts' does not exist.",
                        "File 'node_modules/a/index.ts' does not exist.",
                        "File 'node_modules/a/index.tsx' does not exist.",
                        "File 'node_modules/a/index.d.ts' exist - use it as a name resolution result.",
                        "======== Module name 'a' was successfully resolved to 'node_modules/a/index.d.ts'. ========"
                    ],
                    "afterNpmInstallProgram: execute module resolution normally.");

                const afterNpmInstallProgramDiagnostics = afterNpmInstallProgram.getSemanticDiagnostics(afterNpmInstallProgram.getSourceFile("file1.ts"));
                assert.lengthOf(afterNpmInstallProgramDiagnostics, 0, `afterNpmInstallProgram: program is well-formed with import.`);
            }
        });

        it("can reuse ambient module declarations from non-modified files", () => {
            const files = [
                { name: "/a/b/app.ts", text: SourceText.New("", "import * as fs from 'fs'", "") },
                { name: "/a/b/node.d.ts", text: SourceText.New("", "", "declare module 'fs' {}") }
            ];
            const options = { target: ScriptTarget.ES2015, traceResolution: true };
            const program = newProgram(files, files.map(f => f.name), options);
            assert.deepEqual(program.host.getTrace(),
                [
                    "======== Resolving module 'fs' from '/a/b/app.ts'. ========",
                    "Module resolution kind is not specified, using 'Classic'.",
                    "File '/a/b/fs.ts' does not exist.",
                    "File '/a/b/fs.tsx' does not exist.",
                    "File '/a/b/fs.d.ts' does not exist.",
                    "File '/a/fs.ts' does not exist.",
                    "File '/a/fs.tsx' does not exist.",
                    "File '/a/fs.d.ts' does not exist.",
                    "File '/fs.ts' does not exist.",
                    "File '/fs.tsx' does not exist.",
                    "File '/fs.d.ts' does not exist.",
                    "File '/a/b/node_modules/@types/fs/package.json' does not exist.",
                    "File '/a/b/node_modules/@types/fs.d.ts' does not exist.",
                    "File '/a/b/node_modules/@types/fs/index.d.ts' does not exist.",
                    "File '/a/node_modules/@types/fs/package.json' does not exist.",
                    "File '/a/node_modules/@types/fs.d.ts' does not exist.",
                    "File '/a/node_modules/@types/fs/index.d.ts' does not exist.",
                    "File '/node_modules/@types/fs/package.json' does not exist.",
                    "File '/node_modules/@types/fs.d.ts' does not exist.",
                    "File '/node_modules/@types/fs/index.d.ts' does not exist.",
                    "File '/a/b/fs.js' does not exist.",
                    "File '/a/b/fs.jsx' does not exist.",
                    "File '/a/fs.js' does not exist.",
                    "File '/a/fs.jsx' does not exist.",
                    "File '/fs.js' does not exist.",
                    "File '/fs.jsx' does not exist.",
                    "======== Module name 'fs' was not resolved. ========",
                ], "should look for 'fs'");

            const program_2 = updateProgram(program, program.getRootFileNames(), options, f => {
                f[0].text = f[0].text.updateProgram("var x = 1;");
            });
            assert.deepEqual(program_2.host.getTrace(), [
                "Module 'fs' was resolved as ambient module declared in '/a/b/node.d.ts' since this file was not modified."
            ], "should reuse 'fs' since node.d.ts was not changed");

            const program_3 = updateProgram(program_2, program_2.getRootFileNames(), options, f => {
                f[0].text = f[0].text.updateProgram("var y = 1;");
                f[1].text = f[1].text.updateProgram("declare var process: any");
            });
            assert.deepEqual(program_3.host.getTrace(),
                [
                    "======== Resolving module 'fs' from '/a/b/app.ts'. ========",
                    "Module resolution kind is not specified, using 'Classic'.",
                    "File '/a/b/fs.ts' does not exist.",
                    "File '/a/b/fs.tsx' does not exist.",
                    "File '/a/b/fs.d.ts' does not exist.",
                    "File '/a/fs.ts' does not exist.",
                    "File '/a/fs.tsx' does not exist.",
                    "File '/a/fs.d.ts' does not exist.",
                    "File '/fs.ts' does not exist.",
                    "File '/fs.tsx' does not exist.",
                    "File '/fs.d.ts' does not exist.",
                    "File '/a/b/node_modules/@types/fs/package.json' does not exist.",
                    "File '/a/b/node_modules/@types/fs.d.ts' does not exist.",
                    "File '/a/b/node_modules/@types/fs/index.d.ts' does not exist.",
                    "File '/a/node_modules/@types/fs/package.json' does not exist.",
                    "File '/a/node_modules/@types/fs.d.ts' does not exist.",
                    "File '/a/node_modules/@types/fs/index.d.ts' does not exist.",
                    "File '/node_modules/@types/fs/package.json' does not exist.",
                    "File '/node_modules/@types/fs.d.ts' does not exist.",
                    "File '/node_modules/@types/fs/index.d.ts' does not exist.",
                    "File '/a/b/fs.js' does not exist.",
                    "File '/a/b/fs.jsx' does not exist.",
                    "File '/a/fs.js' does not exist.",
                    "File '/a/fs.jsx' does not exist.",
                    "File '/fs.js' does not exist.",
                    "File '/fs.jsx' does not exist.",
                    "======== Module name 'fs' was not resolved. ========",
                ], "should look for 'fs' again since node.d.ts was changed");
        });

        it("can reuse module resolutions from non-modified files", () => {
            const files = [
                { name: "a1.ts", text: SourceText.New("", "", "let x = 1;") },
                { name: "a2.ts", text: SourceText.New("", "", "let x = 1;") },
                { name: "b1.ts", text: SourceText.New("", "export class B { x: number; }", "") },
                { name: "b2.ts", text: SourceText.New("", "export class B { x: number; }", "") },
                { name: "node_modules/@types/typerefs1/index.d.ts", text: SourceText.New("", "", "declare let z: string;") },
                { name: "node_modules/@types/typerefs2/index.d.ts", text: SourceText.New("", "", "declare let z: string;") },
                {
                    name: "f1.ts",
                    text:
                    SourceText.New(
                        `/// <reference path="a1.ts"/>${newLine}/// <reference types="typerefs1"/>${newLine}/// <reference no-default-lib="true"/>`,
                        `import { B } from './b1';${newLine}export let BB = B;`,
                        "declare module './b1' { interface B { y: string; } }")
                },
                {
                    name: "f2.ts",
                    text: SourceText.New(
                        `/// <reference path="a2.ts"/>${newLine}/// <reference types="typerefs2"/>`,
                        `import { B } from './b2';${newLine}import { BB } from './f1';`,
                        "(new BB).x; (new BB).y;")
                },
            ];

            const options: CompilerOptions = { target: ScriptTarget.ES2015, traceResolution: true, moduleResolution: ModuleResolutionKind.Classic };
            const program_1 = newProgram(files, files.map(f => f.name), options);
            let expectedErrors = 0;
            {
                assert.deepEqual(program_1.host.getTrace(),
                    [
                        "======== Resolving type reference directive 'typerefs1', containing file 'f1.ts', root directory 'node_modules/@types'. ========",
                        "Resolving with primary search path 'node_modules/@types'.",
                        "File 'node_modules/@types/typerefs1/package.json' does not exist.",
                        "File 'node_modules/@types/typerefs1/index.d.ts' exist - use it as a name resolution result.",
                        "======== Type reference directive 'typerefs1' was successfully resolved to 'node_modules/@types/typerefs1/index.d.ts', primary: true. ========",
                        "======== Resolving module './b1' from 'f1.ts'. ========",
                        "Explicitly specified module resolution kind: 'Classic'.",
                        "File 'b1.ts' exist - use it as a name resolution result.",
                        "======== Module name './b1' was successfully resolved to 'b1.ts'. ========",
                        "======== Resolving type reference directive 'typerefs2', containing file 'f2.ts', root directory 'node_modules/@types'. ========",
                        "Resolving with primary search path 'node_modules/@types'.",
                        "File 'node_modules/@types/typerefs2/package.json' does not exist.",
                        "File 'node_modules/@types/typerefs2/index.d.ts' exist - use it as a name resolution result.",
                        "======== Type reference directive 'typerefs2' was successfully resolved to 'node_modules/@types/typerefs2/index.d.ts', primary: true. ========",
                        "======== Resolving module './b2' from 'f2.ts'. ========",
                        "Explicitly specified module resolution kind: 'Classic'.",
                        "File 'b2.ts' exist - use it as a name resolution result.",
                        "======== Module name './b2' was successfully resolved to 'b2.ts'. ========",
                        "======== Resolving module './f1' from 'f2.ts'. ========",
                        "Explicitly specified module resolution kind: 'Classic'.",
                        "File 'f1.ts' exist - use it as a name resolution result.",
                        "======== Module name './f1' was successfully resolved to 'f1.ts'. ========"
                    ],
                    "program_1: execute module resolution normally.");

                const program_1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("f2.ts"));
                assert.lengthOf(program_1Diagnostics, expectedErrors, `initial program should be well-formed`);
            }
            const indexOfF1 = 6;
            const program_2 = updateProgram(program_1, program_1.getRootFileNames(), options, f => {
                const newSourceText = f[indexOfF1].text.updateReferences(`/// <reference path="a1.ts"/>${newLine}/// <reference types="typerefs1"/>`);
                f[indexOfF1] = { name: "f1.ts", text: newSourceText };
            });

            {
                const program_2Diagnostics = program_2.getSemanticDiagnostics(program_2.getSourceFile("f2.ts"));
                assert.lengthOf(program_2Diagnostics, expectedErrors, `removing no-default-lib shouldn't affect any types used.`);

                assert.deepEqual(program_2.host.getTrace(), [
                    "======== Resolving type reference directive 'typerefs1', containing file 'f1.ts', root directory 'node_modules/@types'. ========",
                    "Resolving with primary search path 'node_modules/@types'.",
                    "File 'node_modules/@types/typerefs1/package.json' does not exist.",
                    "File 'node_modules/@types/typerefs1/index.d.ts' exist - use it as a name resolution result.",
                    "======== Type reference directive 'typerefs1' was successfully resolved to 'node_modules/@types/typerefs1/index.d.ts', primary: true. ========",
                    "======== Resolving module './b1' from 'f1.ts'. ========",
                    "Explicitly specified module resolution kind: 'Classic'.",
                    "File 'b1.ts' exist - use it as a name resolution result.",
                    "======== Module name './b1' was successfully resolved to 'b1.ts'. ========",
                    "======== Resolving type reference directive 'typerefs2', containing file 'f2.ts', root directory 'node_modules/@types'. ========",
                    "Resolving with primary search path 'node_modules/@types'.",
                    "File 'node_modules/@types/typerefs2/package.json' does not exist.",
                    "File 'node_modules/@types/typerefs2/index.d.ts' exist - use it as a name resolution result.",
                    "======== Type reference directive 'typerefs2' was successfully resolved to 'node_modules/@types/typerefs2/index.d.ts', primary: true. ========",
                    "Reusing resolution of module './b2' to file 'f2.ts' from old program.",
                    "Reusing resolution of module './f1' to file 'f2.ts' from old program."
                ], "program_2: reuse module resolutions in f2 since it is unchanged");
            }

            const program_3 = updateProgram(program_2, program_2.getRootFileNames(), options, f => {
                const newSourceText = f[indexOfF1].text.updateReferences(`/// <reference path="a1.ts"/>`);
                f[indexOfF1] = { name: "f1.ts", text: newSourceText };
            });

            {
                const program_3Diagnostics = program_3.getSemanticDiagnostics(program_3.getSourceFile("f2.ts"));
                assert.lengthOf(program_3Diagnostics, expectedErrors, `typerefs2 was unused, so diagnostics should be unaffected.`);

                assert.deepEqual(program_3.host.getTrace(), [
                    "======== Resolving module './b1' from 'f1.ts'. ========",
                    "Explicitly specified module resolution kind: 'Classic'.",
                    "File 'b1.ts' exist - use it as a name resolution result.",
                    "======== Module name './b1' was successfully resolved to 'b1.ts'. ========",
                    "======== Resolving type reference directive 'typerefs2', containing file 'f2.ts', root directory 'node_modules/@types'. ========",
                    "Resolving with primary search path 'node_modules/@types'.",
                    "File 'node_modules/@types/typerefs2/package.json' does not exist.",
                    "File 'node_modules/@types/typerefs2/index.d.ts' exist - use it as a name resolution result.",
                    "======== Type reference directive 'typerefs2' was successfully resolved to 'node_modules/@types/typerefs2/index.d.ts', primary: true. ========",
                    "Reusing resolution of module './b2' to file 'f2.ts' from old program.",
                    "Reusing resolution of module './f1' to file 'f2.ts' from old program."
                ], "program_3: reuse module resolutions in f2 since it is unchanged");
            }

            const program_4 = updateProgram(program_3, program_3.getRootFileNames(), options, f => {
                const newSourceText = f[indexOfF1].text.updateReferences("");
                f[indexOfF1] = { name: "f1.ts", text: newSourceText };
            });

            {
                const program_4Diagnostics = program_4.getSemanticDiagnostics(program_4.getSourceFile("f2.ts"));
                assert.lengthOf(program_4Diagnostics, expectedErrors, `a1.ts was unused, so diagnostics should be unaffected.`);

                assert.deepEqual(program_4.host.getTrace(), [
                    "======== Resolving module './b1' from 'f1.ts'. ========",
                    "Explicitly specified module resolution kind: 'Classic'.",
                    "File 'b1.ts' exist - use it as a name resolution result.",
                    "======== Module name './b1' was successfully resolved to 'b1.ts'. ========",
                    "======== Resolving type reference directive 'typerefs2', containing file 'f2.ts', root directory 'node_modules/@types'. ========",
                    "Resolving with primary search path 'node_modules/@types'.",
                    "File 'node_modules/@types/typerefs2/package.json' does not exist.",
                    "File 'node_modules/@types/typerefs2/index.d.ts' exist - use it as a name resolution result.",
                    "======== Type reference directive 'typerefs2' was successfully resolved to 'node_modules/@types/typerefs2/index.d.ts', primary: true. ========",
                    "Reusing resolution of module './b2' to file 'f2.ts' from old program.",
                    "Reusing resolution of module './f1' to file 'f2.ts' from old program."
                ], "program_4: reuse module resolutions in f2 since it is unchanged");
            }

            const program_5 = updateProgram(program_4, program_4.getRootFileNames(), options, f => {
                const newSourceText = f[indexOfF1].text.updateImportsAndExports(`import { B } from './b1';`);
                f[indexOfF1] = { name: "f1.ts", text: newSourceText };
            });

            {
                const program_5Diagnostics = program_5.getSemanticDiagnostics(program_5.getSourceFile("f2.ts"));
                assert.lengthOf(program_5Diagnostics, ++expectedErrors, `import of BB in f1 fails. BB is of type any. Add one error`);

                assert.deepEqual(program_5.host.getTrace(), [
                    "======== Resolving module './b1' from 'f1.ts'. ========",
                    "Explicitly specified module resolution kind: 'Classic'.",
                    "File 'b1.ts' exist - use it as a name resolution result.",
                    "======== Module name './b1' was successfully resolved to 'b1.ts'. ========"
                ], "program_5: exports do not affect program structure, so f2's resolutions are silently reused.");
            }

            const program_6 = updateProgram(program_5, program_5.getRootFileNames(), options, f => {
                const newSourceText = f[indexOfF1].text.updateProgram("");
                f[indexOfF1] = { name: "f1.ts", text: newSourceText };
            });

            {
                const program_6Diagnostics = program_6.getSemanticDiagnostics(program_6.getSourceFile("f2.ts"));
                assert.lengthOf(program_6Diagnostics, expectedErrors, `import of BB in f1 fails.`);

                assert.deepEqual(program_6.host.getTrace(), [
                    "======== Resolving module './b1' from 'f1.ts'. ========",
                    "Explicitly specified module resolution kind: 'Classic'.",
                    "File 'b1.ts' exist - use it as a name resolution result.",
                    "======== Module name './b1' was successfully resolved to 'b1.ts'. ========",
                    "======== Resolving type reference directive 'typerefs2', containing file 'f2.ts', root directory 'node_modules/@types'. ========",
                    "Resolving with primary search path 'node_modules/@types'.",
                    "File 'node_modules/@types/typerefs2/package.json' does not exist.",
                    "File 'node_modules/@types/typerefs2/index.d.ts' exist - use it as a name resolution result.",
                    "======== Type reference directive 'typerefs2' was successfully resolved to 'node_modules/@types/typerefs2/index.d.ts', primary: true. ========",
                    "Reusing resolution of module './b2' to file 'f2.ts' from old program.",
                    "Reusing resolution of module './f1' to file 'f2.ts' from old program."
                ], "program_6: reuse module resolutions in f2 since it is unchanged");
            }

            const program_7 = updateProgram(program_6, program_6.getRootFileNames(), options, f => {
                const newSourceText = f[indexOfF1].text.updateImportsAndExports("");
                f[indexOfF1] = { name: "f1.ts", text: newSourceText };
            });

            {
                const program_7Diagnostics = program_7.getSemanticDiagnostics(program_7.getSourceFile("f2.ts"));
                assert.lengthOf(program_7Diagnostics, expectedErrors, `removing import is noop with respect to program, so no change in diagnostics.`);

                assert.deepEqual(program_7.host.getTrace(), [
                    "======== Resolving type reference directive 'typerefs2', containing file 'f2.ts', root directory 'node_modules/@types'. ========",
                    "Resolving with primary search path 'node_modules/@types'.",
                    "File 'node_modules/@types/typerefs2/package.json' does not exist.",
                    "File 'node_modules/@types/typerefs2/index.d.ts' exist - use it as a name resolution result.",
                    "======== Type reference directive 'typerefs2' was successfully resolved to 'node_modules/@types/typerefs2/index.d.ts', primary: true. ========",
                    "Reusing resolution of module './b2' to file 'f2.ts' from old program.",
                    "Reusing resolution of module './f1' to file 'f2.ts' from old program."
                ], "program_7 should reuse module resolutions in f2 since it is unchanged");
            }
        });

        describe("redirects", () => {
            const axIndex = "/node_modules/a/node_modules/x/index.d.ts";
            const axPackage = "/node_modules/a/node_modules/x/package.json";
            const bxIndex = "/node_modules/b/node_modules/x/index.d.ts";
            const bxPackage = "/node_modules/b/node_modules/x/package.json";
            const root = "/a.ts";
            const compilerOptions = { target, moduleResolution: ModuleResolutionKind.NodeJs };

            function createRedirectProgram(options?: { bText: string, bVersion: string }): ProgramWithSourceTexts {
                const files: NamedSourceText[] = [
                    {
                        name: "/node_modules/a/index.d.ts",
                        text: SourceText.New("", 'import X from "x";', "export function a(x: X): void;"),
                    },
                    {
                        name: axIndex,
                        text: SourceText.New("", "", "export default class X { private x: number; }"),
                    },
                    {
                        name: axPackage,
                        text: SourceText.New("", "", JSON.stringify({ name: "x", version: "1.2.3" })),
                    },
                    {
                        name: "/node_modules/b/index.d.ts",
                        text: SourceText.New("", 'import X from "x";', "export const b: X;"),
                    },
                    {
                        name: bxIndex,
                        text: SourceText.New("", "", options ? options.bText : "export default class X { private x: number; }"),
                    },
                    {
                        name: bxPackage,
                        text: SourceText.New("", "", JSON.stringify({ name: "x", version: options ? options.bVersion : "1.2.3" })),
                    },
                    {
                        name: root,
                        text: SourceText.New("", 'import { a } from "a"; import { b } from "b";', "a(b)"),
                    },
                ];

                return newProgram(files, [root], compilerOptions);
            }

            function updateRedirectProgram(program: ProgramWithSourceTexts, updater: (files: NamedSourceText[]) => void): ProgramWithSourceTexts {
                return updateProgram(program, [root], compilerOptions, updater);
            }

            it("No changes -> redirect not broken", () => {
                const program_1 = createRedirectProgram();

                const program_2 = updateRedirectProgram(program_1, files => {
                    updateProgramText(files, root, "const x = 1;");
                });
                assert.equal(program_1.structureIsReused, StructureIsReused.Completely);
                assert.deepEqual(program_2.getSemanticDiagnostics(), emptyArray);
            });

            it("Target changes -> redirect broken", () => {
                const program_1 = createRedirectProgram();
                assert.deepEqual(program_1.getSemanticDiagnostics(), emptyArray);

                const program_2 = updateRedirectProgram(program_1, files => {
                    updateProgramText(files, axIndex, "export default class X { private x: number; private y: number; }");
                    updateProgramText(files, axPackage, JSON.stringify('{ name: "x", version: "1.2.4" }'));
                });
                assert.equal(program_1.structureIsReused, StructureIsReused.Not);
                assert.lengthOf(program_2.getSemanticDiagnostics(), 1);
            });

            it("Underlying changes -> redirect broken", () => {
                const program_1 = createRedirectProgram();

                const program_2 = updateRedirectProgram(program_1, files => {
                    updateProgramText(files, bxIndex, "export default class X { private x: number; private y: number; }");
                    updateProgramText(files, bxPackage, JSON.stringify({ name: "x", version: "1.2.4" }));
                });
                assert.equal(program_1.structureIsReused, StructureIsReused.Not);
                assert.lengthOf(program_2.getSemanticDiagnostics(), 1);
            });

            it("Previously duplicate packages -> program structure not reused", () => {
                const program_1 = createRedirectProgram({ bVersion: "1.2.4", bText: "export = class X { private x: number; }" });

                const program_2 = updateRedirectProgram(program_1, files => {
                    updateProgramText(files, bxIndex, "export default class X { private x: number; }");
                    updateProgramText(files, bxPackage, JSON.stringify({ name: "x", version: "1.2.3" }));
                });
                assert.equal(program_1.structureIsReused, StructureIsReused.Not);
                assert.deepEqual(program_2.getSemanticDiagnostics(), []);
            });
        });
    });

    describe("host is optional", () => {
        it("should work if host is not provided", () => {
            createProgram([], {});
        });
    });

    import TestSystem = ts.TestFSWithWatch.TestServerHost;
    type FileOrFolder = ts.TestFSWithWatch.FileOrFolder;
    import createTestSystem = ts.TestFSWithWatch.createWatchedSystem;
    import libFile = ts.TestFSWithWatch.libFile;

    describe("isProgramUptoDate should return true when there is no change in compiler options and", () => {
        function verifyProgramIsUptoDate(
            program: Program,
            newRootFileNames: string[],
            newOptions: CompilerOptions
        ) {
            const actual = isProgramUptoDate(
                program, newRootFileNames, newOptions,
                path => program.getSourceFileByPath(path).version, /*fileExists*/ returnFalse,
                /*hasInvalidatedResolution*/ returnFalse,
                /*hasChangedAutomaticTypeDirectiveNames*/ false
            );
            assert.isTrue(actual);
        }

        function duplicate(options: CompilerOptions): CompilerOptions;
        function duplicate(fileNames: string[]): string[];
        function duplicate(filesOrOptions: CompilerOptions | string[]) {
            return JSON.parse(JSON.stringify(filesOrOptions));
        }

        function createWatchingSystemHost(host: TestSystem) {
            return ts.createWatchingSystemHost(/*pretty*/ undefined, host);
        }

        function verifyProgramWithoutConfigFile(watchingSystemHost: WatchingSystemHost, rootFiles: string[], options: CompilerOptions) {
            const program = createWatchModeWithoutConfigFile(rootFiles, options, watchingSystemHost)();
            verifyProgramIsUptoDate(program, duplicate(rootFiles), duplicate(options));
        }

        function getConfigParseResult(watchingSystemHost: WatchingSystemHost, configFileName: string) {
            return parseConfigFile(configFileName, {}, watchingSystemHost.system, watchingSystemHost.reportDiagnostic, watchingSystemHost.reportWatchDiagnostic);
        }

        function verifyProgramWithConfigFile(watchingSystemHost: WatchingSystemHost, configFile: string) {
            const result = getConfigParseResult(watchingSystemHost, configFile);
            const program = createWatchModeWithConfigFile(result, {}, watchingSystemHost)();
            const { fileNames, options } = getConfigParseResult(watchingSystemHost, configFile);
            verifyProgramIsUptoDate(program, fileNames, options);
        }

        function verifyProgram(files: FileOrFolder[], rootFiles: string[], options: CompilerOptions, configFile: string) {
            const watchingSystemHost = createWatchingSystemHost(createTestSystem(files));
            verifyProgramWithoutConfigFile(watchingSystemHost, rootFiles, options);
            verifyProgramWithConfigFile(watchingSystemHost, configFile);
        }

        it("has empty options", () => {
            const file1: FileOrFolder = {
                path: "/a/b/file1.ts",
                content: "let x = 1"
            };
            const file2: FileOrFolder = {
                path: "/a/b/file2.ts",
                content: "let y = 1"
            };
            const configFile: FileOrFolder = {
                path: "/a/b/tsconfig.json",
                content: "{}"
            };
            verifyProgram([file1, file2, libFile, configFile], [file1.path, file2.path], {}, configFile.path);
        });

        it("has lib specified in the options", () => {
            const compilerOptions: CompilerOptions = { lib: ["es5", "es2015.promise"] };
            const app: FileOrFolder = {
                path: "/src/app.ts",
                content: "var x: Promise<string>;"
            };
            const configFile: FileOrFolder = {
                path: "/src/tsconfig.json",
                content: JSON.stringify({ compilerOptions })
            };
            const es5Lib: FileOrFolder = {
                path: "/compiler/lib.es5.d.ts",
                content: "declare const eval: any"
            };
            const es2015Promise: FileOrFolder = {
                path: "/compiler/lib.es2015.promise.d.ts",
                content: "declare class Promise<T> {}"
            };

            verifyProgram([app, configFile, es5Lib, es2015Promise], [app.path], compilerOptions, configFile.path);
        });

        it("has paths specified in the options", () => {
            const compilerOptions: CompilerOptions = {
                baseUrl: ".",
                paths: {
                    "*": [
                        "packages/mail/data/*",
                        "packages/styles/*",
                        "*"
                    ]
                }
            };
            const app: FileOrFolder = {
                path: "/src/packages/framework/app.ts",
                content: 'import classc from "module1/lib/file1";\
                          import classD from "module3/file3";\
                          let x = new classc();\
                          let y = new classD();'
            };
            const module1: FileOrFolder = {
                path: "/src/packages/mail/data/module1/lib/file1.ts",
                content: 'import classc from "module2/file2";export default classc;',
            };
            const module2: FileOrFolder = {
                path: "/src/packages/mail/data/module1/lib/module2/file2.ts",
                content: 'class classc { method2() { return "hello"; } }\nexport default classc',
            };
            const module3: FileOrFolder = {
                path: "/src/packages/styles/module3/file3.ts",
                content: "class classD { method() { return 10; } }\nexport default classD;"
            };
            const configFile: FileOrFolder = {
                path: "/src/tsconfig.json",
                content: JSON.stringify({ compilerOptions })
            };

            verifyProgram([app, module1, module2, module3, libFile, configFile], [app.path], compilerOptions, configFile.path);
        });

        it("has include paths specified in tsconfig file", () => {
            const compilerOptions: CompilerOptions = {
                baseUrl: ".",
                paths: {
                    "*": [
                        "packages/mail/data/*",
                        "packages/styles/*",
                        "*"
                    ]
                }
            };
            const app: FileOrFolder = {
                path: "/src/packages/framework/app.ts",
                content: 'import classc from "module1/lib/file1";\
                          import classD from "module3/file3";\
                          let x = new classc();\
                          let y = new classD();'
            };
            const module1: FileOrFolder = {
                path: "/src/packages/mail/data/module1/lib/file1.ts",
                content: 'import classc from "module2/file2";export default classc;',
            };
            const module2: FileOrFolder = {
                path: "/src/packages/mail/data/module1/lib/module2/file2.ts",
                content: 'class classc { method2() { return "hello"; } }\nexport default classc',
            };
            const module3: FileOrFolder = {
                path: "/src/packages/styles/module3/file3.ts",
                content: "class classD { method() { return 10; } }\nexport default classD;"
            };
            const configFile: FileOrFolder = {
                path: "/src/tsconfig.json",
                content: JSON.stringify({ compilerOptions, include: ["packages/**/ *.ts"] })
            };

            const watchingSystemHost = createWatchingSystemHost(createTestSystem([app, module1, module2, module3, libFile, configFile]));
            verifyProgramWithConfigFile(watchingSystemHost, configFile.path);
        });
    });
}


text:
<?php

namespace Arius\Tests\Lang\Pl;

use Arius\NumberFormatter;

class SpelloutOrdinalTest extends \PHPUnit_Framework_TestCase
{
    protected $formatter;

    protected function setUp()
    {
        $this->formatter = new NumberFormatter('pl', NumberFormatter::SPELLOUT);
        $this->formatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, "%spellout-ordinal");

        $this->masculineFormatter = new NumberFormatter('pl', NumberFormatter::SPELLOUT);
        $this->masculineFormatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, "%spellout-ordinal-masculine");
    }

    public function testDigits()
    {
        $randomNumber = rand(1,100000);

        $this->assertEquals(
            $this->formatter->format($randomNumber),
            $this->masculineFormatter->format($randomNumber)
        );
    }
}


text:
package eg.projects;

import eg.TaskRunner;

/**
 * The selection and creation of a ProjectCommands
 * object based on the project type
 */
public class ProjectSelector {

   private final TaskRunner runner;

   /**
    * @param runner  the reference to TaskRunner
    */
   public ProjectSelector(TaskRunner runner) {
      this.runner = runner;
   }

   /**
    * Returns a new ProjectCommands
    *
    * @param projType  the project type
    * @return  the ProjectCommands
    */
   public ProjectCommands createProject(ProjectTypes projType) {
      ProjectCommands newProj = null;
      switch (projType) {
         case JAVA:
            newProj = new JavaProject(runner);
            break;
         case HTML:
            newProj = new HtmlProject();
            break;
         case PERL:
            newProj = new PerlProject(runner);
            break;
         case PYTHON:
            newProj = new PythonProject(runner);
            break;
         case R:
            newProj = new RProject(runner);
            break;
         case GENERIC:
            newProj = new GenericProject(runner);
            break;
      }
      return newProj;
   }
}


text:
<?php
namespace hvasoares\phplombok;
class DelegatePropertyTemplate {
	public function generateSupportCode(){
		return
"public function setDelegateCallQueue(\$value){
	\$this->delegateCallQueue = \$value;
	\$this->delegateCallQueue->setReflectedObject(\$this->annotatedObject);
}
public function __call(\$method,\$args){
	try{
		if(method_exists(\$this,'magicMethod'))
			return \$this
				->magicMethod(\$method,\$args);
		return \$this->delegateCallQueue->call(\$method,\$args);
	}catch(\BadMethodCallException \$ex){
		return \$this->delegateCallQueue->call(\$method,\$args);
	}
}";
	}
}
?>


text:
namespace extensions {

// Implements the chrome.usersPrivate.getWhitelistedUsers method.
class UsersPrivateGetWhitelistedUsersFunction
    : public UIThreadExtensionFunction {
 public:
  UsersPrivateGetWhitelistedUsersFunction();
  DECLARE_EXTENSION_FUNCTION("usersPrivate.getWhitelistedUsers",
                             USERSPRIVATE_GETWHITELISTEDUSERS);

 protected:
  ~UsersPrivateGetWhitelistedUsersFunction() override;

  // ExtensionFunction overrides.
  ResponseAction Run() override;

 private:
  ChromeExtensionFunctionDetails chrome_details_;

  DISALLOW_COPY_AND_ASSIGN(UsersPrivateGetWhitelistedUsersFunction);
};

// Implements the chrome.usersPrivate.addWhitelistedUser method.
class UsersPrivateAddWhitelistedUserFunction
    : public UIThreadExtensionFunction {
 public:
  UsersPrivateAddWhitelistedUserFunction();
  DECLARE_EXTENSION_FUNCTION("usersPrivate.addWhitelistedUser",
                             USERSPRIVATE_ADDWHITELISTEDUSER);

 protected:
  ~UsersPrivateAddWhitelistedUserFunction() override;

  // AsyncExtensionFunction overrides.
  ResponseAction Run() override;

 private:
  ChromeExtensionFunctionDetails chrome_details_;

  DISALLOW_COPY_AND_ASSIGN(UsersPrivateAddWhitelistedUserFunction);
};

// Implements the chrome.usersPrivate.removeWhitelistedUser method.
class UsersPrivateRemoveWhitelistedUserFunction
    : public UIThreadExtensionFunction {
 public:
  UsersPrivateRemoveWhitelistedUserFunction();
  DECLARE_EXTENSION_FUNCTION("usersPrivate.removeWhitelistedUser",
                             USERSPRIVATE_REMOVEWHITELISTEDUSER);

 protected:
  ~UsersPrivateRemoveWhitelistedUserFunction() override;

  // ExtensionFunction overrides.
  ResponseAction Run() override;

 private:
  ChromeExtensionFunctionDetails chrome_details_;

  DISALLOW_COPY_AND_ASSIGN(UsersPrivateRemoveWhitelistedUserFunction);
};

// Implements the chrome.usersPrivate.isCurrentUserOwner method.
class UsersPrivateIsCurrentUserOwnerFunction
    : public UIThreadExtensionFunction {
 public:
  UsersPrivateIsCurrentUserOwnerFunction();
  DECLARE_EXTENSION_FUNCTION("usersPrivate.isCurrentUserOwner",
                             USERSPRIVATE_ISCURRENTUSEROWNER);

 protected:
  ~UsersPrivateIsCurrentUserOwnerFunction() override;

  // ExtensionFunction overrides.
  ResponseAction Run() override;

 private:
  ChromeExtensionFunctionDetails chrome_details_;

  DISALLOW_COPY_AND_ASSIGN(UsersPrivateIsCurrentUserOwnerFunction);
};

// Implements the chrome.usersPrivate.isWhitelistManaged method.
class UsersPrivateIsWhitelistManagedFunction
    : public UIThreadExtensionFunction {
 public:
  UsersPrivateIsWhitelistManagedFunction();
  DECLARE_EXTENSION_FUNCTION("usersPrivate.isWhitelistManaged",
                             USERSPRIVATE_ISWHITELISTMANAGED);

 protected:
  ~UsersPrivateIsWhitelistManagedFunction() override;

  // ExtensionFunction overrides.
  ResponseAction Run() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(UsersPrivateIsWhitelistManagedFunction);
};

}  // namespace extensions

#endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_USERS_PRIVATE_USERS_PRIVATE_API_H_


text:
namespace Microsoft.Spectrum.Scanning.Scanners
{
    using System;

    public interface IScanner : IDisposable
    {
        void StartScanning();

        void StopScanning();
    }
}


text:
var SUPPORT_EMAIL = 'support@osf.io';
var SUPPORT_LINK = '' + SUPPORT_EMAIL + '';

var REFRESH_OR_SUPPORT = 'Please refresh the page and try again or contact ' + SUPPORT_LINK + ' if the problem persists.';

module.exports = {
    // TODO
    makePublic: null,
    makePrivate: null,
    registrations: {
        registrationFailed: 'Registration failed. If this problem persists, please contact ' + SUPPORT_EMAIL + '.',
        invalidEmbargoTitle: 'Invalid embargo end date',
        invalidEmbargoMessage: 'Please choose a date more than two days, but less than four years, from today.',
        registerConfirm: 'Are you sure you want to register this project?',
        registerSkipAddons: 'If you choose to continue with the registration at this time we will exclude the contents of any addons that are not copyable. These files will not appear in the final registration.'
    },
    Addons: {
        dataverse: {
            userSettingsError: 'Could not retrieve settings. Please refresh the page or ' +
                'contact ' + SUPPORT_EMAIL + ' if the ' +
                'problem persists.',
            deauthError: 'Could not disconnect the Dataverse account at this time.',
            authError: 'Sorry, but there was a problem connecting to that instance of Dataverse. It ' +
                'is likely that the instance hasn\'t been upgraded to Dataverse 4.0. If you ' +
                'have any questions or believe this to be an error, please contact ' +
                'support@osf.io.',
            authInvalid: 'Your Dataverse API token is invalid.',
            authSuccess: 'Your Dataverse account was linked.',
            datasetDeaccessioned: 'This dataset has already been deaccessioned on the Dataverse ' +
                'and cannot be connected to the OSF.',
            forbiddenCharacters: 'This dataset cannot be connected due to forbidden characters ' +
                'in one or more of the dataset\'s file names. This issue has been forwarded to our ' +
                'development team.',
            setDatasetError: 'Could not connect to this dataset.',
            widgetInvalid: 'The credentials associated with this Dataverse account ' +
                'appear to be invalid.',
            widgetError: 'There was a problem connecting to the Dataverse.'
        },
        dropbox: {
            // Shown on clicking "Delete Access Token" for dropbox
            confirmDeauth: 'Are you sure you want to disconnect the Dropbox account? ' +
                'This will revoke access to Dropbox for all projects you have ' +
                'associated with this account.',
            deauthError: 'Could not disconnect Dropbox account at this time',
        },
        figshare: {
            confirmDeauth: 'Are you sure you want to disconnect the figshare account? ' +
                'This will revoke access to figshare for all projects you have ' +
                'associated with this account.',
        },
        // TODO
        github: {
            confirmDeauth: 'Are you sure you want to disconnect the GitHub account? ' +
                'This will revoke access to GitHub for all projects you have ' +
                'associated with this account.',
        },
        s3: {
            confirmDeauth: 'Are you sure you want to disconnect the S3 account? ' +
                'This will revoke access to S3 for all projects you have ' +
                'associated with this account.',
        },
        googledrive: {
          // Shown on clicking "Delete Access Token" for googledrive
            confirmDeauth: 'Are you sure you want to disconnect the Google Drive account? ' +
                'This will revoke access to Google Drive for all projects you have ' +
                'associated with this account.',
            deauthError: 'Could not disconnect the Google Drive account at this time',
        }
    },
    apiOauth2Application: {
        discardUnchanged: 'Are you sure you want to discard your unsaved changes?',
        deactivateConfirm: 'Are you sure you want to deactivate this application for all users and revoke all access tokens? This cannot be reversed.',
        deactivateError: 'Could not deactivate application. Please wait a few minutes and try again, or contact ' + SUPPORT_LINK + ' if the problem persists.',
        dataFetchError: 'Data not loaded. ' + REFRESH_OR_SUPPORT,
        dataListFetchError: 'Could not load list of developer applications at this time. ' + REFRESH_OR_SUPPORT,
        dataSendError: 'Error sending data to the server: check that all fields are valid, or contact ' + SUPPORT_LINK + ' if the problem persists.',
        creationSuccess: 'Successfully registered new application',
        dataUpdated: 'Application data updated'
    }
};


text: `Password Reset`


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.wesjd</groupId>
        <artifactId>anvilgui-parent</artifactId>
        <version>1.5.3-SNAPSHOT</version>
    </parent>

    <artifactId>anvilgui-1_7_R4</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>craftbukkit</artifactId>
            <version>1.7.10-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.wesjd</groupId>
            <artifactId>anvilgui-abstraction</artifactId>
            <version>${project.parent.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>


text: {% include 'boxitapp' %}