"1.5ghz", "ram" => "1 gig", "os" => "os x 10.4.1")) die('Sequence 4 failed'); # Mapped sequence if ($yaml['domains'] != array("yaml.org", "php.net")) die("Key: 'domains' failed"); # A sequence like this. if ($yaml[5] != array("program" => "Adium", "platform" => "OS X", "type" => "Chat Client")) die('Sequence 5 failed'); # A folded block as a mapped value if ($yaml['no time'] != "There isn't any time for your tricks!\nDo you understand?") die("Key: 'no time' failed"); # A literal block as a mapped value if ($yaml['some time'] != "There is nothing but time\nfor your tricks.") die("Key: 'some time' failed"); # Crazy combinations if ($yaml['databases'] != array( array("name" => "spartan", "notes" => array( "Needs to be backed up", "Needs to be normalized" ), "type" => "mysql" ))) die("Key: 'databases' failed"); # You can be a bit tricky if ($yaml["if: you'd"] != "like") die("Key: 'if: you\'d' failed"); # Inline sequences if ($yaml[6] != array("One", "Two", "Three", "Four")) die("Sequence 6 failed"); # Nested Inline Sequences if ($yaml[7] != array("One", array("Two", "And", "Three"), "Four", "Five")) die("Sequence 7 failed"); # Nested Nested Inline Sequences if ($yaml[8] != array( "This", array("Is", "Getting", array("Ridiculous", "Guys")), "Seriously", array("Show", "Mercy"))) die("Sequence 8 failed"); # Inline mappings if ($yaml[9] != array("name" => "chris", "age" => "young", "brand" => "lucky strike")) die("Sequence 9 failed"); # Nested inline mappings if ($yaml[10] != array("name" => "mark", "age" => "older than chris", "brand" => array("marlboro", "lucky strike"))) die("Sequence 10 failed"); # References -- they're shaky, but functional if ($yaml['dynamic languages'] != array('Perl', 'Python', 'PHP', 'Ruby')) die("Key: 'dynamic languages' failed"); if ($yaml['compiled languages'] != array('C/C++', 'Java')) die("Key: 'compiled languages' failed"); if ($yaml['all languages'] != array( array('Perl', 'Python', 'PHP', 'Ruby'), array('C/C++', 'Java') )) die("Key: 'all languages' failed"); # Added in .2.2: Escaped quotes if ($yaml[11] != "you know, this shouldn't work. but it does.") die("Sequence 11 failed."); if ($yaml[12] != "that's my value.") die("Sequence 12 failed."); if ($yaml[13] != "again, that's my value.") die("Sequence 13 failed."); if ($yaml[14] != "here's to \"quotes\", boss.") die("Sequence 14 failed."); if ($yaml[15] != array( 'name' => "Foo, Bar's", 'age' => 20)) die("Sequence 15 failed."); if ($yaml[16] != array( 0 => "a", 1 => array (0 => 1, 1 => 2), 2 => "b")) die("Sequence 16 failed."); if ($yaml['endloop'] != "Does this line in the end indeed make Spyc go to an infinite loop?") die("[endloop] failed."); print "spyc.yaml parsed correctly\n"; ?>