<commit_before>//var tape = require('tape')
var pull = require('pull-stream')
var fork = require('../')
var assert = require('assert')
var interleave = require('interleavings')

interleave.test(function (async) {
  var n = 2, results = []

  var f = fork(
    function (data, sinks) {
      return data % 2
    },
    function (i, sinks) {
      return pull(
              async.through(),
              pull.collect(function (err, value) {
                if(err) throw err
                results[i] = value
                done()
              }))
    })

  pull(pull.values([1,2,3,4,5,6,7,8]), async.through(), f)

  var values

  function done () {
    if(--n) return
    assert.deepEqual(results, [
      [2, 4, 6, 8],
      [1, 3, 5, 7]
    ])
    async.done()
  }

})
<commit_msg>tests for adding a stream on the fly<commit_after>//var tape = require('tape')
var pull = require('pull-stream')
var fork = require('../')
var assert = require('assert')
var interleave = require('interleavings')

interleave.test(function (async) {
  var n = 2, results = []

  var f = fork(
    function (data, sinks) {
      return data % 2
    },
    function (i, sinks) {
      return pull(
              async.through(),
              pull.collect(function (err, value) {
                if(err) throw err
                results[i] = value
                done()
              }))
    })

  pull(pull.values([1,2,3,4,5,6,7,8]), async.through(), f)

  var values

  function done () {
    if(--n) return
    assert.deepEqual(results, [
      [2, 4, 6, 8],
      [1, 3, 5, 7]
    ])
    async.done()
  }

})

interleave.test(function (async) {
  var n = 2, results = []

  var f = fork(
    function (data, sinks) {
      return data % 2
    },
    function (i, sinks) {
      return pull(
              async.through(),
              pull.collect(function (err, value) {
                if(err) throw err
                results[i] = value
                done()
              }))
    })

  pull(pull.values([]), async.through(), f)

  var values

  function done () {
    if(--n) return
    assert.deepEqual(results, [
      [2, 4, 6, 8],
      [1, 3, 5, 7]
    ])
    async.done()
  }

})


{'fraction_non_alphanumeric': 0.15842490842490842, 'fraction_numerical': 0.021062271062271064, 'mean_word_length': 1.7869897959183674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '167607', 'n_tokens_mistral': 763, 'n_tokens_neox': 707, 'n_words': 184}