<?php
function test_assert($string, $arguments = array()) {
// Make sure we don't pass in an empty string.
assert('$string !== \'\' && (empty($arguments) || strtr($string, $arguments) !== \'\')', 'empty fail:' . $string);
// Make sure we don't translate unnecessarily.
if (empty($arguments)) {
assert('empty($arguments) || strtr($string, $arguments) != implode($arguments)', 'unnecesary fail: ' . $string);
}
}
test_assert('@test1', ['@test1' => 'test']);
test_assert('@test2', ['@test2' => 'test']);
test_assert('@test3 foo', ['@test3' => 'test3', '@test_not_used' => 'test']);
test_assert('@test4 foo', ['@test4' => 'test4']);
test_assert('@test5a@test5b', ['@test5a' => '', '@test5b' => '']);
test_assert('');
preferences:
34.55 ms | 402 KiB | 5 Q