YtsBasicTests.yml (4403B)
1 --- %YAML:1.0 2 test: Simple Sequence 3 brief: | 4 You can specify a list in YAML by placing each 5 member of the list on a new line with an opening 6 dash. These lists are called sequences. 7 yaml: | 8 - apple 9 - banana 10 - carrot 11 php: | 12 array('apple', 'banana', 'carrot') 13 --- 14 test: Sequence With Item Being Null In The Middle 15 brief: | 16 You can specify a list in YAML by placing each 17 member of the list on a new line with an opening 18 dash. These lists are called sequences. 19 yaml: | 20 - apple 21 - 22 - carrot 23 php: | 24 array('apple', null, 'carrot') 25 --- 26 test: Sequence With Last Item Being Null 27 brief: | 28 You can specify a list in YAML by placing each 29 member of the list on a new line with an opening 30 dash. These lists are called sequences. 31 yaml: | 32 - apple 33 - banana 34 - 35 php: | 36 array('apple', 'banana', null) 37 --- 38 test: Nested Sequences 39 brief: | 40 You can include a sequence within another 41 sequence by giving the sequence an empty 42 dash, followed by an indented list. 43 yaml: | 44 - 45 - foo 46 - bar 47 - baz 48 php: | 49 array(array('foo', 'bar', 'baz')) 50 --- 51 test: Mixed Sequences 52 brief: | 53 Sequences can contain any YAML data, 54 including strings and other sequences. 55 yaml: | 56 - apple 57 - 58 - foo 59 - bar 60 - x123 61 - banana 62 - carrot 63 php: | 64 array('apple', array('foo', 'bar', 'x123'), 'banana', 'carrot') 65 --- 66 test: Deeply Nested Sequences 67 brief: | 68 Sequences can be nested even deeper, with each 69 level of indentation representing a level of 70 depth. 71 yaml: | 72 - 73 - 74 - uno 75 - dos 76 php: | 77 array(array(array('uno', 'dos'))) 78 --- 79 test: Simple Mapping 80 brief: | 81 You can add a keyed list (also known as a dictionary or 82 hash) to your document by placing each member of the 83 list on a new line, with a colon separating the key 84 from its value. In YAML, this type of list is called 85 a mapping. 86 yaml: | 87 foo: whatever 88 bar: stuff 89 php: | 90 array('foo' => 'whatever', 'bar' => 'stuff') 91 --- 92 test: Sequence in a Mapping 93 brief: | 94 A value in a mapping can be a sequence. 95 yaml: | 96 foo: whatever 97 bar: 98 - uno 99 - dos 100 php: | 101 array('foo' => 'whatever', 'bar' => array('uno', 'dos')) 102 --- 103 test: Nested Mappings 104 brief: | 105 A value in a mapping can be another mapping. 106 yaml: | 107 foo: whatever 108 bar: 109 fruit: apple 110 name: steve 111 sport: baseball 112 php: | 113 array( 114 'foo' => 'whatever', 115 'bar' => array( 116 'fruit' => 'apple', 117 'name' => 'steve', 118 'sport' => 'baseball' 119 ) 120 ) 121 --- 122 test: Mixed Mapping 123 brief: | 124 A mapping can contain any assortment 125 of mappings and sequences as values. 126 yaml: | 127 foo: whatever 128 bar: 129 - 130 fruit: apple 131 name: steve 132 sport: baseball 133 - more 134 - 135 python: rocks 136 perl: papers 137 ruby: scissorses 138 php: | 139 array( 140 'foo' => 'whatever', 141 'bar' => array( 142 array( 143 'fruit' => 'apple', 144 'name' => 'steve', 145 'sport' => 'baseball' 146 ), 147 'more', 148 array( 149 'python' => 'rocks', 150 'perl' => 'papers', 151 'ruby' => 'scissorses' 152 ) 153 ) 154 ) 155 --- 156 test: Mapping-in-Sequence Shortcut 157 todo: true 158 brief: | 159 If you are adding a mapping to a sequence, you 160 can place the mapping on the same line as the 161 dash as a shortcut. 162 yaml: | 163 - work on YAML.py: 164 - work on Store 165 php: | 166 array(array('work on YAML.py' => array('work on Store'))) 167 --- 168 test: Sequence-in-Mapping Shortcut 169 todo: true 170 brief: | 171 The dash in a sequence counts as indentation, so 172 you can add a sequence inside of a mapping without 173 needing spaces as indentation. 174 yaml: | 175 allow: 176 - 'localhost' 177 - '%.sourceforge.net' 178 - '%.freepan.org' 179 php: | 180 array('allow' => array('localhost', '%.sourceforge.net', '%.freepan.org')) 181 --- 182 todo: true 183 test: Merge key 184 brief: | 185 A merge key ('<<') can be used in a mapping to insert other mappings. If 186 the value associated with the merge key is a mapping, each of its key/value 187 pairs is inserted into the current mapping. 188 yaml: | 189 mapping: 190 name: Joe 191 job: Accountant 192 <<: 193 age: 38 194 php: | 195 array( 196 'mapping' => 197 array( 198 'name' => 'Joe', 199 'job' => 'Accountant', 200 'age' => 38 201 ) 202 )