Skip to content

Commit

Permalink
move away from custom test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdickinson committed Dec 21, 2012
1 parent 546c715 commit 3de3e46
Showing 1 changed file with 4 additions and 41 deletions.
45 changes: 4 additions & 41 deletions test.js
Expand Up @@ -12,19 +12,7 @@ Array.prototype.indexOf = function(n) {
var test = require('tape')
, language = require('./index')

var tests = [
test_select_single // all of the selectors by themselves
, test_select_multiple // all of the combinators
]

start()

function setup() {
}

// integration tests because reasons.

function test_select_single(t) {
test("test select single", function test_select_single(t) {
var data = document.createElement('div')

data.id = 'one-id'
Expand All @@ -39,9 +27,9 @@ function test_select_single(t) {
t.ok(!language('.one-other-class')(data))
t.ok(language('div')(data))
t.ok(!language('span')(data))
}
})

function test_select_multiple(t) {
test("test select multiple", function test_select_multiple(t) {
var div = document.createElement('div')

div.innerHTML = [
Expand Down Expand Up @@ -84,29 +72,4 @@ function test_select_multiple(t) {
t.ok(!language(':contains(world)')(data))
t.ok(language(':contains(hello)')(data2))
t.ok(language(':contains(world)')(data2))
}

// utils

function out(what) {
if(typeof console !== 'undefined') console.log(what)
}

// test runner

function start() {
run()
}

function run() {
var next = tests.shift()
, now = +(new Date())

if(!next) return

setup()

test(next.name || 'unknown', next).end()
out('# '+next.name+' '+(+(new Date()) - now)+'ms\n')
run()
}
})

0 comments on commit 3de3e46

Please sign in to comment.