Skip to content

Commit

Permalink
Replicate ini tests for YAML format in make tests array.
Browse files Browse the repository at this point in the history
Most elements in the makefile tests array should always be identical (e.g.
'options', 'md5', etc.) Those that should differ basically just append a
string to indicate that it's a YAML-formatted makefile. So, we save a bunch
of duplication, that'd be hard to keep in sync, by simply duplicating the
tests programmatically.
  • Loading branch information
ergonlogic committed Feb 9, 2015
1 parent c340bc4 commit d957613
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions tests/makeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,13 @@ function testMakeUseDistributionAsCore() {
}

function getMakefile($key) {
static $tests = array(
static $tests;
$tests = $this->listMakefileTests();
return $tests[$key];
}

function listMakefileTests() {
$tests = array(
'bzr' => array(
'name' => 'Bzr',
'makefile' => 'bzr.make',
Expand Down Expand Up @@ -497,27 +503,13 @@ function getMakefile($key) {
'md5' => '2aed36201ede1849ce43d9b7d6f7e9e1',
'options' => array('no-core' => NULL, 'contrib-destination' => '.'),
),
'contrib-destination-yaml' => array(
'name' => 'Contrib-destination attribute in YAML format',
'makefile' => 'contrib-destination.make.yml',
'build' => TRUE,
'md5' => '2aed36201ede1849ce43d9b7d6f7e9e1',
'options' => array('no-core' => NULL, 'contrib-destination' => '.'),
),
'defaults' => array(
'name' => 'Test defaults array.',
'makefile' => 'defaults.make',
'build' => TRUE,
'md5' => 'e6c0d6b37cd8573cbd188742b95a274e',
'options' => array('no-core' => NULL, 'contrib-destination' => '.'),
),
'defaults-yaml' => array(
'name' => 'Test defaults array in YAML format.',
'makefile' => 'defaults.make.yml',
'build' => TRUE,
'md5' => 'e6c0d6b37cd8573cbd188742b95a274e',
'options' => array('no-core' => NULL, 'contrib-destination' => '.'),
),
'file' => array(
'name' => 'File extraction',
'makefile' => 'file.make',
Expand Down Expand Up @@ -713,6 +705,13 @@ function getMakefile($key) {
'options' => array(),
),
);
return $tests[$key];
// Replicate ini tests for YAML format.
foreach ($tests as $id => $test) {
$id_yaml = $id . '-yaml';
$tests[$id_yaml] = $test;
$tests[$id_yaml]['name'] = $tests[$id]['name'] . '(in YAML format)';
$tests[$id_yaml]['makefile'] = $tests[$id]['makefile'] . '.yml';
}
return $tests;
}
}

0 comments on commit d957613

Please sign in to comment.