setup-php/__tests__/config.test.ts

22 lines
953 B
TypeScript
Raw Normal View History

2019-10-08 19:42:54 +07:00
import * as config from '../src/config';
describe('Config tests', () => {
2021-09-09 08:38:12 +07:00
it.each`
ini_values | os_version | output
${'a=b, c=d'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b\nc=d"'}
${'a=b, c=d'} | ${'linux'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
${'a=b, c=d'} | ${'darwin'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
2021-09-09 08:49:49 +07:00
${'a=b & ~c'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'b & ~c\'"'}
${'a="~(b)"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=\'~(b)\'"'}
${'a="b, c"'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b, c"'}
2021-09-09 08:38:12 +07:00
${'a=b, c=d'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
`(
'checking addINIValues on $os_version',
async ({ini_values, os_version, output}) => {
expect(await config.addINIValues(ini_values, os_version)).toContain(
output
);
}
);
2019-10-08 19:42:54 +07:00
});