B2G/gecko/testing/mochitest/server.js
/**
 * Heuristic function that determines whether a given path
 * is a test case to be executed in the harness, or just
 * a supporting file.
 */
Heuristic function that determines whether a given path
is a test case to be executed in the harness, or just
a supporting file.
Heuristic function that determines whether a given path is a test case to be executed in the harness or just a supporting file .
function isTest(filename, pattern)
{
  if (pattern)
    return pattern.test(filename);
  var testPrefix = typeof(_TEST_PREFIX) == "string" ? _TEST_PREFIX : "test_";
  var testPattern = new RegExp("^" + testPrefix);
  pathPieces = filename.split('/');
  return testPattern.test(pathPieces[pathPieces.length - 1]) &&
         filename.indexOf(".js") == -1 &&
         filename.indexOf(".css") == -1 &&
         !/\^headers\^$/.test(filename);
}
function isTest ( filename , pattern ) { if ( pattern ) return pattern . test ( filename ) ; var testPrefix = typeof ( _TEST_PREFIX ) == "string" ? _TEST_PREFIX : "test_" ; var testPattern = new RegExp ( "^" + testPrefix ) ; pathPieces = filename . split ( '/' ) ; return testPattern . test ( pathPieces [ pathPieces . length - 1 ] ) && filename . indexOf ( ".js" ) == - 1 && filename . indexOf ( ".css" ) == - 1 && ! / \^headers\^$ / . test ( filename ) ; }
Heuristic function that determines whether a given path
 is a test case to be executed in the harness, or just
 a supporting file.
Heuristic function that determines whether a given path is a test case to be executed in the harness or just a supporting file .
// File name is a URL style path to a test file, make sure that we check for // tests that start with the appropriate prefix.