File: yaml_parse_spec_null.phpt

package info (click to toggle)
php-yaml 2.0.2%2B1.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 904 kB
  • sloc: ansic: 4,832; xml: 751; makefile: 1
file content (59 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--TEST--
Yaml 1.1 Spec - null
--SKIPIF--
<?php if(!extension_loaded('yaml')) die('skip yaml n/a'); ?>
--FILE--
<?php
  var_dump(yaml_parse('
# A document may be null.
---
---
# This mapping has four keys,
# one has a value.
empty:
canonical: ~
english: null
~: null key
---
# This sequence has five
# entries, two have values.
sparse:
  - ~
  - 2nd entry
  -
  - 4th entry
  - Null
', -1));
?>
--EXPECT--
array(3) {
  [0]=>
  NULL
  [1]=>
  array(4) {
    ["empty"]=>
    NULL
    ["canonical"]=>
    NULL
    ["english"]=>
    NULL
    [""]=>
    string(8) "null key"
  }
  [2]=>
  array(1) {
    ["sparse"]=>
    array(5) {
      [0]=>
      NULL
      [1]=>
      string(9) "2nd entry"
      [2]=>
      NULL
      [3]=>
      string(9) "4th entry"
      [4]=>
      NULL
    }
  }
}