diff options
| author | Felipe Pena <felipe@php.net> | 2008-11-02 18:20:57 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2008-11-02 18:20:57 +0000 |
| commit | 3efabcf22c6d8334881c6fa72963a5f80c1e2105 (patch) | |
| tree | 274736ca9ad37546659aa30857abc16e6f422a28 | |
| parent | 881c30db8823cc62831ea88d4bee6ae1f160e72b (diff) | |
| download | php-git-3efabcf22c6d8334881c6fa72963a5f80c1e2105.tar.gz | |
- New test
| -rw-r--r-- | ext/standard/tests/strings/str_getcsv_001.phpt | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/str_getcsv_001.phpt b/ext/standard/tests/strings/str_getcsv_001.phpt new file mode 100644 index 0000000000..a5fd780283 --- /dev/null +++ b/ext/standard/tests/strings/str_getcsv_001.phpt @@ -0,0 +1,115 @@ +--TEST-- +str_getcsv(): Testing using various arguments +--FILE-- +<?php + +// unicode input[, unicode delimiter[, unicode enclosure[, unicode escape]]] +var_dump(str_getcsv('"f", "o", ""')); +print "-----\n"; +var_dump(str_getcsv('foo||bar', '|')); +print "-----\n"; +var_dump(str_getcsv('foo|bar', '|')); +print "-----\n"; +var_dump(str_getcsv('|foo|-|bar|', '-', '|')); +print "-----\n"; +var_dump(str_getcsv('|f.|.|bar|.|-|-.|', '.', '|', '-')); +print "-----\n"; +var_dump(str_getcsv('.foo..bar.', '.', '.', '.')); +print "-----\n"; +var_dump(str_getcsv('.foo. .bar.', ' ', '.', '.')); +print "-----\n"; +var_dump(str_getcsv((binary)'1foo1 1bar111', (binary)' ', (binary)'1 ', (binary) '\ ')); +print "-----\n"; +var_dump(str_getcsv('.foo . . bar .', ' ', '.', '')); +print "-----\n"; +var_dump(str_getcsv('" "" "', ' ')); +print "-----\n"; +var_dump(str_getcsv(NULL)); +print "-----\n"; +var_dump(str_getcsv('')); +print "-----\n"; + +?> +--EXPECT-- +array(3) { + [0]=> + unicode(1) "f" + [1]=> + unicode(1) "o" + [2]=> + unicode(0) "" +} +----- +array(3) { + [0]=> + unicode(3) "foo" + [1]=> + unicode(0) "" + [2]=> + unicode(3) "bar" +} +----- +array(2) { + [0]=> + unicode(3) "foo" + [1]=> + unicode(3) "bar" +} +----- +array(2) { + [0]=> + unicode(3) "foo" + [1]=> + unicode(3) "bar" +} +----- +array(3) { + [0]=> + unicode(2) "f." + [1]=> + unicode(3) "bar" + [2]=> + unicode(4) "-|-." +} +----- +array(1) { + [0]=> + unicode(7) "foo.bar" +} +----- +array(2) { + [0]=> + unicode(3) "foo" + [1]=> + unicode(3) "bar" +} +----- +array(2) { + [0]=> + string(3) "foo" + [1]=> + string(4) "bar1" +} +----- +array(2) { + [0]=> + unicode(5) "foo " + [1]=> + unicode(7) " bar " +} +----- +array(1) { + [0]=> + unicode(3) " " " +} +----- +array(1) { + [0]=> + unicode(0) "" +} +----- +array(1) { + [0]=> + unicode(0) "" +} +----- |
