| 1 | # Ported from helix-term/tests/test/languages/yaml.rs (the auto-indent o/O/<ret> |
| 2 | # tests). The corpus checks both directions — reindent (every line re-indents to |
| 3 | # its own column) and typing (pressing Enter at a line's end indents the next |
| 4 | # line) — which together cover the open-below (o), open-above (O) and split |
| 5 | # (<ret>) cases those tests assert. Fixtures whose top-level shape differs (a |
| 6 | # bare sequence vs a mapping) are separated into their own `---` documents, since |
| 7 | # they cannot coexist at the root of one document. |
| 8 | |
| 9 | # The canonical fixture: nested mappings, a key whose value is an indented |
| 10 | # sequence, scalar pairs, and a trailing keyless map entry. |
| 11 | top: |
| 12 | baz: foo |
| 13 | bazi: |
| 14 | more: yes |
| 15 | why: because |
| 16 | quux: |
| 17 | - 1 |
| 18 | - 2 |
| 19 | bax: foox |
| 20 | fook: |
| 21 | |
| 22 | # Block scalars inside a nested mapping: literal (|) keeps newlines, folded (>) |
| 23 | # joins lines; both indent their body one level under the key. |
| 24 | literal: |
| 25 | baz: foo |
| 26 | bax: | |
| 27 | some |
| 28 | multi |
| 29 | line |
| 30 | string |
| 31 | folded: |
| 32 | baz: foo |
| 33 | bax: > |
| 34 | some |
| 35 | multi |
| 36 | line |
| 37 | string |
| 38 | |
| 39 | # A mapping value that is a sequence of mappings, nested two levels deep. |
| 40 | root: |
| 41 | baz: |
| 42 | - one: two |
| 43 | three: four |
| 44 | - top: |
| 45 | baz: foo |
| 46 | bax: foox |
| 47 | |
| 48 | # Flow collections stay on one line. |
| 49 | flow-map: { a: 1, b: 2 } |
| 50 | flow-seq: [1, 2, 3] |
| 51 | |
| 52 | # Anchors, aliases and merge keys. An anchor on a key whose mapping/sequence body |
| 53 | # follows beneath indents like a plain key (the fix this corpus guards). |
| 54 | defaults: &defaults |
| 55 | adapter: postgres |
| 56 | host: localhost |
| 57 | pool: &pool |
| 58 | - primary |
| 59 | - replica |
| 60 | development: |
| 61 | <<: *defaults |
| 62 | database: dev |
| 63 | |
| 64 | # A top-level sequence whose item is a mapping; continuation keys align under the |
| 65 | # first key and a later key dedents back to the item's map level. |
| 66 | --- |
| 67 | - top: |
| 68 | baz: foo |
| 69 | bax: foox |
| 70 | fook: done |
| 71 | |
| 72 | # Multiple documents in one stream. |
| 73 | --- |
| 74 | doc: one |
| 75 | nested: |
| 76 | value: 1 |
| 77 | --- |
| 78 | doc: two |
| 79 | list: |
| 80 | - x |
| 81 | - y |
| 82 | |
| 83 | # Keyless entries and an empty block scalar. Opening a line after each indents to |
| 84 | # the child / body level (the keyless-pair and block_scalar rules); the following |
| 85 | # line here sits at the outer column, so the corpus records that as a reviewed |
| 86 | # typing over-indent note rather than a hard assertion. |
| 87 | holder: |
| 88 | keyless: |
| 89 | folded: > |
| 90 | plain: value |