summaryrefslogtreecommitdiffstats
path: root/test/fixtures/formatting-prettier
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixtures/formatting-prettier')
-rw-r--r--test/fixtures/formatting-prettier/fmt-1.yml48
-rw-r--r--test/fixtures/formatting-prettier/fmt-2.yml24
-rw-r--r--test/fixtures/formatting-prettier/fmt-3.yml21
3 files changed, 93 insertions, 0 deletions
diff --git a/test/fixtures/formatting-prettier/fmt-1.yml b/test/fixtures/formatting-prettier/fmt-1.yml
new file mode 100644
index 0000000..d74c826
--- /dev/null
+++ b/test/fixtures/formatting-prettier/fmt-1.yml
@@ -0,0 +1,48 @@
+---
+# ^ too many newlines before
+foo: bar # This is a comment has extra spaces preceding it
+
+fruits: # unindented sequence:
+ - apple
+ - orange
+vegetables: # indented sequence:
+ - onion
+ - carrot
+
+quoting:
+ - "that should have double quotes"
+ - "that should remain in single quotes"
+ - 'a string with " inside'
+ # next line has some undesired trailing spaces:
+ - "a string with ' inside"
+ - can't be sure!
+ # next line should be converted to use double quotes:
+ - ["foo", "bar"]
+
+inline-dictionary:
+ - { foo: bar } # should add some spacing between curly braces and content
+ - { foo2: bar2 } # should reduce spacing between curly braces and content
+
+# YAML 1.1 Boolean-hell: https://yaml.org/type/bool.html
+booleans-true:
+ preferred: true # YAML 1.2 compatible!
+ answer-1.1: YES
+ canonical-1.1: y
+ canonical-upper-1.1: Y
+ logical-1.1: True
+ option-1.1: on
+booleans-false:
+ preferred: false # YAML 1.2 compatible!
+ answer-1.1: NO
+ canonical-1.1: n
+ canonical-upper-1.1: N
+ logical-1.1: False
+ option-1.1: off
+
+# ^ double newline should be removed
+overly-indented-vault-value: !vault |
+ $ANSIBLE_VAULT;1.1;AES256
+ 123466303630313
+
+# this file also has 3 newlines at end-of-file instead of one
+
diff --git a/test/fixtures/formatting-prettier/fmt-2.yml b/test/fixtures/formatting-prettier/fmt-2.yml
new file mode 100644
index 0000000..90ac484
--- /dev/null
+++ b/test/fixtures/formatting-prettier/fmt-2.yml
@@ -0,0 +1,24 @@
+# preamble/header comment
+---
+# initial comment
+- foo: bar
+
+- baz: # over indented
+ - qwerty
+ - foobar
+ animals: # under indented
+ - crow
+ - pig
+ - giraffe
+
+- nothing: null # null
+
+- octal:
+ - "0o123" # YAML 1.2 octal
+ - "0123" # YAML 1.1 octal
+
+- integer:
+ - 0 # Not an octal. See #2071
+ - 10
+ - 9999
+ zero: 0 # Not an octal. See #2071
diff --git a/test/fixtures/formatting-prettier/fmt-3.yml b/test/fixtures/formatting-prettier/fmt-3.yml
new file mode 100644
index 0000000..658d550
--- /dev/null
+++ b/test/fixtures/formatting-prettier/fmt-3.yml
@@ -0,0 +1,21 @@
+---
+dummy_map: # eol comment
+ # full line comment not indented
+ something:
+ # full line comment indented
+ # next full line comment indented
+ - or
+ # 1 full line comments over indented
+ # 2 full line comments over indented
+ - other
+ - |
+ # this is part of a string not a yaml comment
+ # also not a comment
+
+# comment before top-level
+second_key:
+ - {} # should drop the extra space in flow map
+ # comment before non top-level
+ - {}
+ # comment before non top-level
+ - []