<commit_before>var test = require('../../src/assertion/ttr')
var dotPath = require('../../src/object/dotPath')

test('create object path from a list of strings', function (t) {
  t.is(dotPath('foo', 'bar', 'baz'), 'foo.bar.baz')
})

test('create object path from an array of strings', function (t) {
  t.is(dotPath(['foo', 'bar', 'baz']), 'foo.bar.baz')
})

test('create object path from a strings', function (t) {
  t.is(dotPath('foo.bar.baz'), 'foo.bar.baz')
})

test('create object path from a list of arguments', function (t) {
  function foo () {
    return dotPath(arguments)
  }

  t.is(foo('foo', 'bar', 'baz'), 'foo.bar.baz')
})

test('create object path from an array of arguments', function (t) {
  function foo () {
    return dotPath(arguments)
  }

  t.is(foo(['foo', 'bar', 'baz']), 'foo.bar.baz')
})

test('create object path from a mixture of arrays and strings', function (t) {
  t.is(dotPath('foo', ['bar', 'baz']), 'foo.bar.baz')
  t.is(dotPath(['foo', 'bar'], 'baz'), 'foo.bar.baz')
  t.is(dotPath(['foo', 'bar'], ['baz']), 'foo.bar.baz')
  t.is(dotPath(['foo'], ['bar'], ['baz']), 'foo.bar.baz')
  t.is(dotPath(['foo'], 'bar', ['baz']), 'foo.bar.baz')
})

test('create object path from a mixture of arrays and strings as arguments', function (t) {
  function foo () {
    return dotPath(arguments)
  }

  t.is(foo('foo', ['bar', 'baz']), 'foo.bar.baz')
  t.is(foo(['foo', 'bar'], 'baz'), 'foo.bar.baz')
  t.is(foo(['foo', 'bar'], ['baz']), 'foo.bar.baz')
  t.is(foo(['foo'], ['bar'], ['baz']), 'foo.bar.baz')
  t.is(foo(['foo'], 'bar', ['baz']), 'foo.bar.baz')
})

test.result()<commit_msg>update test/object/dotPath -- using src/object/toPath, add tests<commit_after>var test = require('../../src/assertion/ttr')
var dotPath = require('../../src/object/toPath')
// var dotPath = require('../../src/object/dotPath')

test('create object path from a list of strings', function (t) {
  t.is(dotPath('foo', 'bar', 'baz'), 'foo.bar.baz')
})

test('create object path from an array of strings', function (t) {
  t.is(dotPath(['foo', 'bar', 'baz']), 'foo.bar.baz')
})

test('create object path from a strings', function (t) {
  t.is(dotPath('foo.bar.baz'), 'foo.bar.baz')
})

test('create object path from a list of arguments', function (t) {
  function foo () {
    return dotPath(arguments)
  }

  t.is(foo('foo', 'bar', 'baz'), 'foo.bar.baz')
})

test('create object path from an array of arguments', function (t) {
  function foo () {
    return dotPath(arguments)
  }

  t.is(foo(['foo', 'bar', 'baz']), 'foo.bar.baz')
})

test('create object path from a mixture of arrays and strings', function (t) {
  t.is(dotPath('foo', ['bar', 'baz']), 'foo.bar.baz')
  t.is(dotPath(['foo', 'bar'], 'baz'), 'foo.bar.baz')
  t.is(dotPath(['foo', 'bar'], ['baz']), 'foo.bar.baz')
  t.is(dotPath(['foo'], ['bar'], ['baz']), 'foo.bar.baz')
  t.is(dotPath(['foo'], 'bar', ['baz']), 'foo.bar.baz')
})

test('create object path from a mixture of arrays and strings as arguments', function (t) {
  function foo () {
    return dotPath(arguments)
  }

  t.is(foo('foo', ['bar', 'baz']), 'foo.bar.baz')
  t.is(foo(['foo', 'bar'], 'baz'), 'foo.bar.baz')
  t.is(foo(['foo', 'bar'], ['baz']), 'foo.bar.baz')
  t.is(foo(['foo'], ['bar'], ['baz']), 'foo.bar.baz')
  t.is(foo(['foo'], 'bar', ['baz']), 'foo.bar.baz')
})

test('create object path when arguments is not the first value', function (t) {
  function foo () {
    return dotPath('options', arguments)
  }

  t.is(foo(['foo', 'bar', 'baz']), 'options.foo.bar.baz')
})

test('create object path discarding any non-string values', function (t) {
  function foo () {
    return dotPath('options', arguments)
  }

  var fn = function () {
    return
  }

  t.is(foo([fn, 'foo', 'bar', 'baz'], fn, new Date(), {a: 1}, 6, null), 'options.foo.bar.baz')
})

test.result()
{'fraction_non_alphanumeric': 0.2502620545073375, 'fraction_numerical': 0.0005241090146750524, 'mean_word_length': 4.137281292059219, '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': '2813145', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1395, 'n_words': 360}