mirror of
https://github.com/leonelquinteros/php-toml.git
synced 2025-01-17 04:18:17 +01:00
Tests modified
This commit is contained in:
parent
82fb6ec5ce
commit
65d2fb1672
@ -24,6 +24,7 @@ TODO
|
||||
- Throw exception on extra chars after keygroup definition
|
||||
- Throw exception on mixed data type arrays
|
||||
- Throw exception on key or keygroup overwriting
|
||||
- Write better tests.
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# This is a TOML document. Boom.
|
||||
|
||||
title = "TOML Example"
|
||||
crazy-string = "With a comment # inside, escaped quotes \" and [brackets]"
|
||||
|
||||
[owner]
|
||||
name = "Tom Preston-Werner"
|
||||
@ -29,20 +28,8 @@ enabled = true
|
||||
[clients]
|
||||
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
|
||||
|
||||
# Multi-line array check
|
||||
key = [
|
||||
1, 2, 3,
|
||||
[
|
||||
1979-05-27T07:32:00Z,
|
||||
1979-05-27T07:32:00Z,
|
||||
],
|
||||
[
|
||||
"10.0.0.1", "Escaped \" quote"
|
||||
]
|
||||
]
|
||||
|
||||
# Line breaks are OK when inside arrays
|
||||
hosts = [
|
||||
"alpha # Try this hash", # Comment here, after string hash.
|
||||
"alpha",
|
||||
"omega"
|
||||
]
|
||||
|
48
tests/extended.toml
Executable file
48
tests/extended.toml
Executable file
@ -0,0 +1,48 @@
|
||||
# This is a TOML document. Boom.
|
||||
|
||||
title = "TOML Example"
|
||||
crazy-string = "With a comment # inside, escaped quotes \" and [brackets]"
|
||||
|
||||
[owner]
|
||||
name = "Tom Preston-Werner"
|
||||
organization = "GitHub"
|
||||
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
|
||||
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
|
||||
|
||||
[database]
|
||||
server = "192.168.1.1"
|
||||
ports = [ 8001, 8001, 8002 ]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
|
||||
[servers]
|
||||
|
||||
# You can indent as you please. Tabs or spaces. TOML don't care.
|
||||
[servers.alpha]
|
||||
ip = "10.0.0.1"
|
||||
dc = "eqdc10"
|
||||
|
||||
[servers.beta]
|
||||
ip = "10.0.0.2"
|
||||
dc = "eqdc10"
|
||||
|
||||
[clients]
|
||||
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
|
||||
|
||||
# Multi-line array check
|
||||
key = [
|
||||
1, 2, 3,
|
||||
[
|
||||
1979-05-27T07:32:00Z,
|
||||
1979-05-27T07:32:00Z,
|
||||
],
|
||||
[
|
||||
"10.0.0.1", "Escaped \" quote"
|
||||
]
|
||||
]
|
||||
|
||||
# Line breaks are OK when inside arrays
|
||||
hosts = [
|
||||
"alpha # Try this hash", # Comment here, after string hash.
|
||||
"omega"
|
||||
]
|
@ -4,6 +4,11 @@ require("../src/toml.php");
|
||||
|
||||
$result = Toml::parseFile('example.toml');
|
||||
|
||||
echo "\n\nToml::parseFile('example.toml'): \n";
|
||||
echo "--------------------------------\n";
|
||||
echo "\n\nToml::parseFile('example.toml'): \n\n";
|
||||
print_r($result);
|
||||
|
||||
|
||||
$result = Toml::parseFile('example.toml');
|
||||
|
||||
echo "\n\nToml::parseFile('extended.toml'): \n\n";
|
||||
print_r($result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user