Skip to content

Instantly share code, notes, and snippets.

@dergachev
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dergachev/c2b3c18d65edf00aa8fd to your computer and use it in GitHub Desktop.
Save dergachev/c2b3c18d65edf00aa8fd to your computer and use it in GitHub Desktop.
====================
Test name: test with tilde, should print NULL
====================
INPUT:
---
1: a
2: ~
RESULT:
array(2) {
[1]=>
string(1) "a"
[2]=>
NULL
}
====================
Test name: test with empty map value, should print NULL, prints empty string
====================
INPUT:
---
1: a
2:
RESULT:
array(2) {
[1]=>
string(1) "a"
[2]=>
string(0) ""
}
<?php
# see http://stackoverflow.com/questions/833927/yaml-dictionary-with-empty-value
include "Spyc.php";
test_spyc("test with tilde, should print NULL", "---
1: a
2: ~");
test_spyc("test with empty map value, should print NULL, prints empty string", "---
1: a
2: ");
function test_spyc($test_name, $input) {
print "\n====================\nTest name: $test_name\n====================\n\n";
print "INPUT:\n\n$input\n\n";
$arr = spyc_load($input);
print "RESULT:\n\n";
var_dump($arr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment