blob: b7cdcab7d38d576ae9c95ffcfa384d2732f53529 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2
3class IndentTest extends PHPUnit_Framework_TestCase {
4
5 protected $Y;
6
7 protected function setUp() {
8 $this->Y = Spyc::YAMLLoad(__DIR__."/indent_1.yaml");
9 }
10
11 public function testIndent_1() {
12 $this->assertEquals (array ('child_1' => 2, 'child_2' => 0, 'child_3' => 1), $this->Y['root']);
13 }
14
15 public function testIndent_2() {
16 $this->assertEquals (array ('child_1' => 1, 'child_2' => 2), $this->Y['root2']);
17 }
18
19 public function testIndent_3() {
20 $this->assertEquals (array (array ('resolutions' => array (1024 => 768, 1920 => 1200), 'producer' => 'Nec')), $this->Y['display']);
21 }
22
23 public function testIndent_4() {
24 $this->assertEquals (array (
25 array ('resolutions' => array (1024 => 768)),
26 array ('resolutions' => array (1920 => 1200)),
27 ), $this->Y['displays']);
28 }
29
30 public function testIndent_5() {
31 $this->assertEquals (array (array (
32 'row' => 0,
33 'col' => 0,
34 'headsets_affected' => array (
35 array (
36 'ports' => array (0),
37 'side' => 'left',
38 )
39 ),
40 'switch_function' => array (
41 'ics_ptt' => true
42 )
43 )), $this->Y['nested_hashes_and_seqs']);
44 }
45
46 public function testIndent_6() {
47 $this->assertEquals (array (
48 'h' => array (
49 array ('a' => 'b', 'a1' => 'b1'),
50 array ('c' => 'd')
51 )
52 ), $this->Y['easier_nest']);
53 }
54
55 public function testIndent_space() {
56 $this->assertEquals ("By four\n spaces", $this->Y['one_space']);
57 }
58
59 public function testListAndComment() {
60 $this->assertEquals (array ('one', 'two', 'three'), $this->Y['list_and_comment']);
61 }
62
63 public function testAnchorAndAlias() {
64 $this->assertEquals (array ('database' => 'rails_dev', 'adapter' => 'mysql', 'host' => 'localhost'), $this->Y['development']);
65 $this->assertEquals (array (1 => 'abc'), $this->Y['zzz']);
66 }
67
68}