Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/types/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ register './text-composable'
register './text-tp2'

register './json'

exports.helpers = require './helpers'
exports.testHelpers = require '../../test/helpers'

File renamed without changes.
7 changes: 7 additions & 0 deletions test/helpers/misc.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Some utility functions.
p = -> #require('util').debug
i = -> #require('util').inspect
fs = require 'fs'

# Cross-transform function. Transform server by client and client by server. Returns
# [server, client].
Expand Down Expand Up @@ -70,3 +71,9 @@ exports.newDocName = do ->
index = 1
-> 'testing_doc_' + index++


# Return a random word from a corpus each time the method is called
exports.randomWord = do ->
words = fs.readFileSync(__dirname + '/jabberwocky.txt').toString().split(/\W+/)
-> words[exports.randomInt(words.length)]

4 changes: 1 addition & 3 deletions test/types/json.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

nativetype = require '../../src/types/json'

randomWord = require './randomWord'

util = require 'util'
p = util.debug
i = util.inspect
Expand All @@ -15,7 +13,7 @@ i = util.inspect
# the changes the op generator will make.
clone = (o) -> JSON.parse(JSON.stringify(o))

{randomInt, randomReal} = require('../helpers')
{randomInt, randomReal, randomWord} = require('../helpers')

randomKey = (obj) ->
if Array.isArray(obj)
Expand Down
11 changes: 0 additions & 11 deletions test/types/randomWord.coffee

This file was deleted.

3 changes: 1 addition & 2 deletions test/types/text-api.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Tests for the text types using the DSL interface
assert = require 'assert'
randomWord = require './randomWord'
{randomInt, randomReal} = require('../helpers')
{randomInt, randomReal, randomWord} = require('../helpers')

types = require '../../src/types'
MicroEvent = require '../../src/client/microevent'
Expand Down
2 changes: 1 addition & 1 deletion test/types/text-composable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
fs = require 'fs'
util = require 'util'

randomWord = require './randomWord'
{randomWord} = require('../helpers')
text = require '../../src/types/text-composable'
p = util.debug
i = util.inspect
Expand Down
3 changes: 1 addition & 2 deletions test/types/text-tp2.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
fs = require 'fs'
util = require 'util'

randomWord = require './randomWord'
text = require '../../src/types/text-tp2'
{randomInt, randomReal, seed, randomizerTest} = require '../helpers'
{randomInt, randomReal, seed, randomizerTest, randomWord} = require '../helpers'

p = util.debug
i = util.inspect
Expand Down
2 changes: 1 addition & 1 deletion test/types/text.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tests for the non-composable op type.

randomWord = require './randomWord'
{randomWord} = require('../helpers')
nativeType = require '../../src/types/text'

genTests = (type) ->
Expand Down
3 changes: 1 addition & 2 deletions test/types/text2.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
fs = require 'fs'
util = require 'util'

randomWord = require './randomWord'
text = require '../../src/types/text2'
{randomInt} = require '../helpers'
{randomInt, randomWord} = require '../helpers'

readOp = (file) ->
op = for c in JSON.parse file.shift()
Expand Down