#################################################
# name: print
# purpose: test print commands
-# expect: TEST::CISTRING
+# expect: TEST::FORMAT
# options: -rr
#################################################
-# Set execution context
-# Attempting compilation
-# Success
-# User Class: test
-# Methods (3):
-# test::testMethod()
-# ZEND_RETURN
-# test::testPrivateMethod()
-# ZEND_RETURN
-# test::testProtectedMethod()
-# ZEND_RETURN
-# User Method testMethod
-# test::testMethod()
-# ZEND_RETURN
+#[Set execution context: %s%eclass.php]
+#[Attempting compilation of %s%eclass.php]
+#[Success]
+#[User Class: test]
+#Methods (3):
+#L%d-%d test::testMethod() %s%eclass.php
+# L%d %s ZEND_RETURN C%d <unused> <unused>
+# L%d-%d test::testPrivateMethod() %s%eclass.php
+# L%d %s ZEND_RETURN C%d <unused> <unused>
+# L%d-%d test::testProtectedMethod() %s%eclass.php
+# L%d %s ZEND_RETURN C%d <unused> <unused>
+#[User Method testMethod]
+# L%d-%d test::testMethod() %s%eclass.php
+# L%d %s ZEND_RETURN C%d <unused> <unused>
#################################################
exec sapi/phpdbg/tests/code/class.php
compile
* Expect stripos() !== false
*/
const CISTRING = 0x00000100;
+
+ /*
+ * Formatted output
+ */
+ const FORMAT = 0x00001000;
/**
* Constructs a new Test object given a specilized phpdbginit file
case 'TEST::CISTRING':
case 'CISTRING': { $this->expect = TEST::CISTRING; } break;
+ case 'TEST::FORMAT':
+ case 'FORMAT': { $this->expect = TEST::FORMAT; } break;
+
default:
throw new TestConfigurationException(
$this->config, "unknown type of expectation (%s)", $chunks[1]);
case '#': { /* do nothing */ } break;
default: {
- $this->match[] = ltrim(substr($trim, 1));
+ $line = preg_replace(
+ "~(\r\n)~", "\n", substr($trim, 1));
+
+ $line = trim($line);
+
+ switch ($this->expect) {
+ case TEST::FORMAT:
+ $this->match[] = str_replace(array(
+ '%e',
+ '%s',
+ '%S',
+ '%a',
+ '%A',
+ '%w',
+ '%i',
+ '%d',
+ '%x',
+ '%f',
+ '%c',
+ '%t',
+ '$T'
+ ), array(
+ '\\' . DIRECTORY_SEPARATOR,
+ '[^\r\n]+',
+ '[^\r\n]*',
+ '.+',
+ '.*',
+ '\s*',
+ '[+-]?\d+',
+ '\d+',
+ '[0-9a-fA-F]+',
+ '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?',
+ '.',
+ '\t',
+ '\t+'
+ ), preg_quote($line));
+ break;
+
+ default: $this->match[] = $line;
+ }
}
}
} break;
$this->diff['gets'][$num] = $line;
}
} continue 2;
+
+ case TEST::FORMAT: {
+ $line = trim($line);
+ if (!preg_match("/^{$this->match[$num]}\$/s", $line)) {
+ $this->diff['wants'][$num] = &$this->match[$num];
+ $this->diff['gets'][$num] = $line;
+ }
+ } continue 2;
}
}
}