For better testing
163166
function _set (data, keys, value) {
  var i = 0;
  var prop;
  var length = keys.length;
  for(; i < length; i ++){
    prop = keys[i];
    if (i === length - 1) {
      // if the last key, set value
      data[prop] = value;
      return;
    }

    if (
      !(prop in data)

      // If the current value is not an object, we will override it.
      // The logic who invoke `.set()` method should make sure `data[prop]` is an object,
      // which `.set()` doesn't concern
      || !is_object(data[prop])
    ) {
      data[prop] = {};
    }

    data = data[prop];
  }
}
343236
function() {
		extend(config, {
			stats: { all: 0, bad: 0 },
			moduleStats: { all: 0, bad: 0 },
			started: +new Date,
			updateRate: 1000,
			blocking: false,
			autostart: true,
			autorun: false,
			filter: "",
			queue: [],
			semaphore: 0
		});

		var tests = id( "qunit-tests" ),
			banner = id( "qunit-banner" ),
			result = id( "qunit-testresult" );

		if ( tests ) {
			tests.innerHTML = "";
		}

		if ( banner ) {
			banner.className = "";
		}

		if ( result ) {
			result.parentNode.removeChild( result );
		}

		if ( tests ) {
			result = document.createElement( "p" );
			result.id = "qunit-testresult";
			result.className = "result";
			tests.parentNode.insertBefore( result, tests );
			result.innerHTML = 'Running...<br/>&nbsp;';
		}
	}
763103
function() {
      console.log('start : init test : ' + bench.initFcts.length);
      for (let i = 0; i < bench.initFcts.length; i++) {
        console.log(
          'initializing test data ' + (i + 1) + '/' + bench.initFcts.length
        );
        if (bench.initFcts[i]) {
          bench.initFcts[i].call(this, bench.CONN.MARIADB.drv);
        }
      }
      this.currentNb = 0;
      console.log('initializing test data done');
    }
320591
def run(self, test):
        ""
        # These parts of Nose's pluggability are baked into
        # nose.core.TextTestRunner. Reproduce them:
        wrapper = self.config.plugins.prepareTest(test)
        if wrapper is not None:
            test = wrapper
        wrapped = self.config.plugins.setOutputStream(self.stream)
        if wrapped is not None:
            self.stream = wrapped

        result = self._makeResult()
        startTime = time()
        try:
            test(result)
        except KeyboardInterrupt:
            # we need to ignore these exception to not
            # show traceback when user intentionally
            # interrupted test suite execution, and
            # to output some reasonable results on
            # already passed and failed tests.
            pass
        stopTime = time()

        # We don't care to hear about errors again at the end; we take care of
        # that in result.addError(), while the tests run.
        # result.printErrors()
        #
        # However, we do need to call this one useful line from
        # nose.result.TextTestResult's implementation of printErrors() to make
        # sure other plugins get a chance to report:
        self.config.plugins.report(self.stream)

        result.printSummary(startTime, stopTime)
        self.config.plugins.finalize(result)
        return result
1104976
def cmp_err(test)
      test.err_result = FileUtils.cmp(test.expected_err_path,
                                      test.result_err_path)
    end
476500
def improve():
    """'"""
    with open(settings.HOSTS_FILE, "r+") as hosts_file:
        contents = hosts_file.read()
        if not settings.START_TOKEN in contents and not settings.END_TOKEN in contents:
            hosts_file.write(settings.START_TOKEN + "\n")
            for site in set(settings.DISTRACTORS):
                hosts_file.write("{0}\t{1}\n".format(settings.REDIRECT_TO, site))
                for sub_domain in settings.SUB_DOMAINS:
                    hosts_file.write("{0}\t{1}.{2}\n".format(settings.REDIRECT_TO, sub_domain, site))
            hosts_file.write(settings.END_TOKEN + "\n")

    reset_network("Concentration is now improved :D!")
276013
function() {
      if (!JSLitmus.currentTest) {
        var test = JSLitmus._queue.shift();
        if (test) {
          jsl.$('stop_button').disabled = false;
          JSLitmus.currentTest = test;
          test.run();
          JSLitmus.renderTest(test);
          if (JSLitmus.onTestStart) JSLitmus.onTestStart(test);
        } else {
          jsl.$('stop_button').disabled = true;
          JSLitmus.renderChart();
        }
      }
    }
8086
function (setUp, tearDown, group) {
    var tests = {};
    var keys = _keys(group);
    for (var i = 0; i < keys.length; i += 1) {
        var k = keys[i];
        if (typeof group[k] === 'function') {
            tests[k] = wrapTest(setUp, tearDown, group[k]);
        }
        else if (typeof group[k] === 'object') {
            tests[k] = wrapGroup(setUp, tearDown, group[k]);
        }
    }
    return tests;
}
1147465
function(input) {
		var needstesting = !this._matches.length;
		if (needstesting || this._matches.every(function(match) {
			return match.$instanceid !== input.$instanceid;
		})) {
			return this._maybeinput(input);
		}
		return false;
	}
1017657
function complete(e) {
    clearTimeout(doneTimeout);
    if (!done) { return; }
    var d = done;
    done = null;
    if (e) {
      // test failure
      if (!(e instanceof Error)) {
        e = new Error(e);
      }
      d(e);
    } else {
      // test passed
      d();
    }
  }
351853
function(tc) {
            var t = this;
            var output = '';
            if (tc.getResult() != TestCase.UNTESTED) {

                output += '        <testcase name="' + encode(tc.getName()) + '"'
                    + ' time="' + (tc.getDuration() / 1000) + '">\n';

                if (tc.getResult() == TestCase.SKIPPED) {
                    output += '            <skipped></skipped>\n';
                }

                tc.getAssertions().forEach(
                    function(assertion) {
                        output += t.getAssertion(assertion);
                    }
                );

                var ge = tc.getGeneralError();
                if (ge) {
                    output += t.getError(ge);
                }

                output += '        </testcase>\n';
            }
            return output;
        }
1353025
def addError(self, test, error):
        
        # test_dict will be None if startTest wasn't called (i.e. exception in setUp/setUpClass)
        # status=BROKEN
        if self.current_sample is not None:
            assertion_name = error[0].__name__
            error_msg = str(error[1]).split('\n')[0]
            error_trace = self._get_trace(error)
            self.current_sample.add_assertion(assertion_name)
            self.current_sample.set_assertion_failed(assertion_name, error_msg, error_trace)
1322606
function(test) {
			var context = this.loopContext;
			var forkContext = this.forkContext;
			var endOfInitSegments = forkContext.head;
			var testSegments = forkContext.makeNext(-1, -1);

			// Update state.
			context.test = test;
			context.endOfInitSegments = endOfInitSegments;
			context.continueDestSegments = context.testSegments = testSegments;
			forkContext.replaceHead(testSegments);
		}
39598
def validate():
    """"""

    errors = dict()
    for test in (test_architecture,
                 test_pyqt_availability,
                 test_pyblish_availability,
                 test_qtconf_availability,
                 test_qtconf_correctness,
                 test_qt_availability):
        try:
            test()
        except Exception as e:
            errors[test] = e

    if not errors:
        print("=" * 78)
        print()
        print(""" - Success!

{exe} is well suited to run Pyblish QML""".format(exe=sys.executable))
        print()
        print("=" * 78)

        return True

    print("=" * 78)
    print()
    print(" - Failed")
    print()
    for test, error in errors.iteritems():
        print(test.__name__)
        print("    %s" % error)
    print()
    print("=" * 78)

    return False
417773
private Map<String, Integer> runSampling(
            final ProctorContext proctorContext,
            final Set<String> targetTestNames,
            final TestType testType,
            final int determinationsToRun
    ) {
        final Set<String> targetTestGroups = getTargetTestGroups(targetTestNames);
        final Map<String, Integer> testGroupToOccurrences = Maps.newTreeMap();
        for (final String testGroup : targetTestGroups) {
            testGroupToOccurrences.put(testGroup, 0);
        }

        for (int i = 0; i < determinationsToRun; ++i) {
            final Identifiers identifiers = TestType.RANDOM.equals(testType)
                    ? new Identifiers(Collections.<TestType, String>emptyMap(), /* randomEnabled */ true)
                    : Identifiers.of(testType, Long.toString(random.nextLong()));
            final AbstractGroups groups = supplier.getRandomGroups(proctorContext, identifiers);
            for (final Entry<String, TestBucket> e : groups.getProctorResult().getBuckets().entrySet()) {
                final String testName = e.getKey();
                if (targetTestNames.contains(testName)) {
                    final int group = e.getValue().getValue();
                    final String testGroup = testName + group;
                    testGroupToOccurrences.put(testGroup, testGroupToOccurrences.get(testGroup) + 1);
                }
            }
        }

        return testGroupToOccurrences;
    }
491610
function checkJs (mode, callback) {
  var exercise = this

  if (!exercise.passed)
    return callback(null, true) // shortcut if we've already had a failure

  gyp.rebuild(copyFauxTempDir, function (err) {
    if (err) {
      exercise.emit('fail', 'Compile mock C++ to test JavaScript: ' + err.message)
      return callback(null, false)
    }

    execWith(copyFauxTempDir, 111, 'FAUX 111\nDone!\n', function (err, pass) {
      if (err)
        return callback(err)
      if (!pass) {
        exercise.emit('fail', 'JavaScript code loads addon and invokes `delay(x, cb)` method')
        return callback(null, false)
      }

      execWith(copyFauxTempDir, 1111, 'FAUX 1111\nDone!\n', function (err, pass) {
        if (err)
          return callback(err)

        exercise.emit(pass ? 'pass' : 'fail'
            , 'JavaScript code loads addon and invokes `delay(x, cb)` method')
        callback(null, pass)
      })
    })
  })
}
935086
function(err) {
        if (err) { done(err); return; }
        var assert = require('assert');
        var difflet = require('difflet')({indent: 2, comment: true});
        try {
          assert.deepEqual(options.test.actual, options.expected, 'Actual should match expected.');
          grunt.log.writeln('Test passed.');
          done();
        } catch (err) {
          grunt.log.subhead('Assertion Failure');
          console.log(difflet.compare(err.expected, err.actual));
          done(err);
        }
      }