IndentTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. require_once ("../Spyc.php");
  3. class IndentTest extends PHPUnit_Framework_TestCase {
  4. protected $Y;
  5. protected function setUp() {
  6. $this->Y = Spyc::YAMLLoad("indent_1.yaml");
  7. }
  8. public function testIndent_1() {
  9. $this->assertEquals (array ('child_1' => 2, 'child_2' => 0, 'child_3' => 1), $this->Y['root']);
  10. }
  11. public function testIndent_2() {
  12. $this->assertEquals (array ('child_1' => 1, 'child_2' => 2), $this->Y['root2']);
  13. }
  14. public function testIndent_3() {
  15. $this->assertEquals (array (array ('resolutions' => array (1024 => 768, 1920 => 1200), 'producer' => 'Nec')), $this->Y['display']);
  16. }
  17. public function testIndent_4() {
  18. $this->assertEquals (array (
  19. array ('resolutions' => array (1024 => 768)),
  20. array ('resolutions' => array (1920 => 1200)),
  21. ), $this->Y['displays']);
  22. }
  23. public function testIndent_5() {
  24. $this->assertEquals (array (array (
  25. 'row' => 0,
  26. 'col' => 0,
  27. 'headsets_affected' => array (
  28. array (
  29. 'ports' => array (0),
  30. 'side' => 'left',
  31. )
  32. ),
  33. 'switch_function' => array (
  34. 'ics_ptt' => true
  35. )
  36. )), $this->Y['nested_hashes_and_seqs']);
  37. }
  38. public function testIndent_6() {
  39. $this->assertEquals (array (
  40. 'h' => array (
  41. array ('a' => 'b', 'a1' => 'b1'),
  42. array ('c' => 'd')
  43. )
  44. ), $this->Y['easier_nest']);
  45. }
  46. public function testIndent_space() {
  47. $this->assertEquals ("By four\n spaces", $this->Y['one_space']);
  48. }
  49. public function testListAndComment() {
  50. $this->assertEquals (array ('one', 'two', 'three'), $this->Y['list_and_comment']);
  51. }
  52. }