Tests: Add tests from YAML 1.2 specification
Write all examples from http://www.yaml.org/spec/1.2/spec.html in independent files in tests/yaml-1.2-spec-examples; and test them with yamllint.pull/4/head
parent
6b5948c06b
commit
431a379c81
@ -0,0 +1,187 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2016 Adrien Vergé
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
|
||||
from tests.common import RuleTestCase
|
||||
|
||||
|
||||
# This file checks examples from YAML 1.2 specification [1] against yamllint.
|
||||
#
|
||||
# [1]: http://www.yaml.org/spec/1.2/spec.html
|
||||
#
|
||||
# Example files generated with:
|
||||
#
|
||||
# from bs4 import BeautifulSoup
|
||||
# with open('spec.html', encoding='iso-8859-1') as f:
|
||||
# soup = BeautifulSoup(f, 'lxml')
|
||||
# for ex in soup.find_all('div', class_='example'):
|
||||
# title = ex.find('p', class_='title').find('b').get_text()
|
||||
# id = '-'.join(title.split('\xa0')[:2])[:-1].lower()
|
||||
# span = ex.find('span', class_='database')
|
||||
# for br in span.find_all("br"):
|
||||
# br.replace_with("\n")
|
||||
# text = text.replace('\u2193', '') # downwards arrow
|
||||
# text = text.replace('\u00b7', ' ') # visible space
|
||||
# text = text.replace('\u21d4', '') # byte order mark
|
||||
# text = text.replace('\u2192', '\t') # right arrow
|
||||
# text = text.replace('\u00b0', '') # empty scalar
|
||||
# with open('tests/yaml-1.2-spec-examples/%s' % id, 'w',
|
||||
# encoding='utf-8') as g:
|
||||
# g.write(text)
|
||||
|
||||
class SpecificationTestCase(RuleTestCase):
|
||||
rule_id = None
|
||||
|
||||
conf_general = ('document-start: disable\n'
|
||||
'comments: {min-spaces-from-content: 1}\n'
|
||||
'braces: {min-spaces-inside: 1, max-spaces-inside: 1}\n'
|
||||
'brackets: {min-spaces-inside: 1, max-spaces-inside: 1}\n')
|
||||
conf_overrides = {
|
||||
'example-2.2': ('colons: {max-spaces-after: 2}\n'),
|
||||
'example-2.4': ('colons: {max-spaces-after: 3}\n'),
|
||||
'example-2.5': ('empty-lines: {max-end: 2}\n'
|
||||
'brackets: {min-spaces-inside: 0, max-spaces-inside: 2}\n'
|
||||
'commas: {max-spaces-before: -1}\n'),
|
||||
'example-2.6': ('braces: {min-spaces-inside: 0, max-spaces-inside: 0}\n'
|
||||
'indentation: disable\n'),
|
||||
'example-2.12': ('empty-lines: {max-end: 1}\n'
|
||||
'colons: {max-spaces-before: -1}\n'),
|
||||
'example-2.16': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-2.18': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-2.19': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-2.28': ('empty-lines: {max-end: 3}\n'),
|
||||
'example-5.3': ('indentation: {indent-sequences: no}\n'
|
||||
'colons: {max-spaces-before: 1}\n'),
|
||||
'example-6.4': ('trailing-spaces: disable\n'),
|
||||
'example-6.5': ('trailing-spaces: disable\n'),
|
||||
'example-6.6': ('trailing-spaces: disable\n'),
|
||||
'example-6.7': ('trailing-spaces: disable\n'),
|
||||
'example-6.8': ('trailing-spaces: disable\n'),
|
||||
'example-6.10': ('empty-lines: {max-end: 2}\n'
|
||||
'trailing-spaces: disable\n'
|
||||
'comments-indentation: disable\n'),
|
||||
'example-6.11': ('empty-lines: {max-end: 1}\n'
|
||||
'comments-indentation: disable\n'),
|
||||
'example-6.13': ('comments-indentation: disable\n'),
|
||||
'example-6.14': ('comments-indentation: disable\n'),
|
||||
'example-6.23': ('colons: {max-spaces-before: 1}\n'),
|
||||
'example-7.4': ('colons: {max-spaces-before: 1}\n'
|
||||
'indentation: disable\n'),
|
||||
'example-7.5': ('trailing-spaces: disable\n'),
|
||||
'example-7.6': ('trailing-spaces: disable\n'),
|
||||
'example-7.7': ('indentation: disable\n'),
|
||||
'example-7.8': ('colons: {max-spaces-before: 1}\n'
|
||||
'indentation: disable\n'),
|
||||
'example-7.9': ('trailing-spaces: disable\n'),
|
||||
'example-7.11': ('colons: {max-spaces-before: 1}\n'
|
||||
'indentation: disable\n'),
|
||||
'example-7.13': ('brackets: {min-spaces-inside: 0, max-spaces-inside: 1}\n'
|
||||
'commas: {max-spaces-before: 1, min-spaces-after: 0}\n'),
|
||||
'example-7.14': ('indentation: disable\n'),
|
||||
'example-7.15': ('braces: {min-spaces-inside: 0, max-spaces-inside: 1}\n'
|
||||
'commas: {max-spaces-before: 1, min-spaces-after: 0}\n'
|
||||
'colons: {max-spaces-before: 1}\n'),
|
||||
'example-7.17': ('indentation: disable\n'),
|
||||
'example-7.18': ('indentation: disable\n'),
|
||||
'example-7.19': ('indentation: disable\n'),
|
||||
'example-7.20': ('colons: {max-spaces-before: 1}\n'
|
||||
'indentation: disable\n'),
|
||||
'example-8.1': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-8.2': ('trailing-spaces: disable\n'),
|
||||
'example-8.5': ('comments-indentation: disable\n'
|
||||
'trailing-spaces: disable\n'),
|
||||
'example-8.6': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-8.7': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-8.8': ('trailing-spaces: disable\n'),
|
||||
'example-8.9': ('empty-lines: {max-end: 1}\n'),
|
||||
'example-8.14': ('colons: {max-spaces-before: 1}\n'),
|
||||
'example-8.16': ('indentation: {spaces: 1}\n'),
|
||||
}
|
||||
|
||||
files = os.listdir('tests/yaml-1.2-spec-examples')
|
||||
assert len(files) == 132
|
||||
|
||||
|
||||
def _gen_test(buffer, conf):
|
||||
def test(self):
|
||||
self.check(buffer, conf)
|
||||
return test
|
||||
|
||||
# TODO
|
||||
# The following tests are blacklisted because they contain rarely-used formats
|
||||
# that yamllint does not handle yet.
|
||||
tmp_blacklist = (
|
||||
'example-2.25',
|
||||
'example-7.16',
|
||||
'example-8.17',
|
||||
'example-8.20',
|
||||
'example-8.22',
|
||||
'example-10.1',
|
||||
)
|
||||
# The following tests are blacklisted (i.e. will not be checked against
|
||||
# yamllint), because pyyaml is currently not able to parse the contents
|
||||
# (using yaml.parse()).
|
||||
pyyaml_blacklist = (
|
||||
'example-2.11',
|
||||
'example-2.23',
|
||||
'example-2.24',
|
||||
'example-2.27',
|
||||
'example-5.10',
|
||||
'example-5.12',
|
||||
'example-5.13',
|
||||
'example-5.14',
|
||||
'example-5.6',
|
||||
'example-6.1',
|
||||
'example-6.12',
|
||||
'example-6.15',
|
||||
'example-6.17',
|
||||
'example-6.18',
|
||||
'example-6.19',
|
||||
'example-6.2',
|
||||
'example-6.20',
|
||||
'example-6.21',
|
||||
'example-6.22',
|
||||
'example-6.24',
|
||||
'example-6.25',
|
||||
'example-6.26',
|
||||
'example-6.27',
|
||||
'example-6.3',
|
||||
'example-7.1',
|
||||
'example-7.10',
|
||||
'example-7.12',
|
||||
'example-7.17',
|
||||
'example-7.2',
|
||||
'example-7.21',
|
||||
'example-7.22',
|
||||
'example-7.3',
|
||||
'example-8.18',
|
||||
'example-8.19',
|
||||
'example-8.21',
|
||||
'example-8.3',
|
||||
'example-9.3',
|
||||
'example-9.4',
|
||||
'example-9.5',
|
||||
)
|
||||
|
||||
for file in files:
|
||||
if file in tmp_blacklist or file in pyyaml_blacklist:
|
||||
continue
|
||||
|
||||
with open('tests/yaml-1.2-spec-examples/' + file) as f:
|
||||
conf = conf_general + conf_overrides.get(file, '')
|
||||
setattr(SpecificationTestCase, 'test_' + file,
|
||||
_gen_test(f.read(), conf))
|
@ -0,0 +1,6 @@
|
||||
Block style: !!map
|
||||
Clark : Evans
|
||||
Ingy : döt Net
|
||||
Oren : Ben-Kiki
|
||||
|
||||
Flow style: !!map { Clark: Evans, Ingy: döt Net, Oren: Ben-Kiki }
|
@ -0,0 +1,6 @@
|
||||
Block style: !!seq
|
||||
- Clark Evans
|
||||
- Ingy döt Net
|
||||
- Oren Ben-Kiki
|
||||
|
||||
Flow style: !!seq [ Clark Evans, Ingy döt Net, Oren Ben-Kiki ]
|
@ -0,0 +1,4 @@
|
||||
Block style: !!str |-
|
||||
String: just a theory.
|
||||
|
||||
Flow style: !!str "String: just a theory."
|
@ -0,0 +1,2 @@
|
||||
!!null null: value for null key
|
||||
key with null value: !!null null
|
@ -0,0 +1,2 @@
|
||||
YAML is a superset of JSON: !!bool true
|
||||
Pluto is a planet: !!bool false
|
@ -0,0 +1,3 @@
|
||||
negative: !!int -12
|
||||
zero: !!int 0
|
||||
positive: !!int 34
|
@ -0,0 +1,5 @@
|
||||
negative: !!float -1
|
||||
zero: !!float 0
|
||||
positive: !!float 2.3e4
|
||||
infinity: !!float .inf
|
||||
not a number: !!float .nan
|
@ -0,0 +1,5 @@
|
||||
A null: null
|
||||
Booleans: [ true, false ]
|
||||
Integers: [ 0, -0, 3, -19 ]
|
||||
Floats: [ 0., -0.0, 12e03, -2E+05 ]
|
||||
Invalid: [ True, Null, 0o7, 0x3A, +12.3 ]
|
@ -0,0 +1,7 @@
|
||||
A null: null
|
||||
Also a null: # Empty
|
||||
Not a null: ""
|
||||
Booleans: [ true, True, false, FALSE ]
|
||||
Integers: [ 0, 0o7, 0x3A, -19 ]
|
||||
Floats: [ 0., -0.0, .5, +12e03, -2E+05 ]
|
||||
Also floats: [ .inf, -.Inf, +.INF, .NAN ]
|
@ -0,0 +1,3 @@
|
||||
- Mark McGwire
|
||||
- Sammy Sosa
|
||||
- Ken Griffey
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
hr:
|
||||
- Mark McGwire
|
||||
# Following node labeled SS
|
||||
- &SS Sammy Sosa
|
||||
rbi:
|
||||
- *SS # Subsequent occurrence
|
||||
- Ken Griffey
|
@ -0,0 +1,9 @@
|
||||
? - Detroit Tigers
|
||||
- Chicago cubs
|
||||
:
|
||||
- 2001-07-23
|
||||
|
||||
? [ New York Yankees,
|
||||
Atlanta Braves ]
|
||||
: [ 2001-07-02, 2001-08-12,
|
||||
2001-08-14 ]
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
# Products purchased
|
||||
- item : Super Hoop
|
||||
quantity: 1
|
||||
- item : Basketball
|
||||
quantity: 4
|
||||
- item : Big Shoes
|
||||
quantity: 1
|
||||
|
@ -0,0 +1,4 @@
|
||||
# ASCII Art
|
||||
--- |
|
||||
\//||\/||
|
||||
// || ||__
|
@ -0,0 +1,4 @@
|
||||
--- >
|
||||
Mark McGwire's
|
||||
year was crippled
|
||||
by a knee injury.
|
@ -0,0 +1,8 @@
|
||||
>
|
||||
Sammy Sosa completed another
|
||||
fine season with great stats.
|
||||
|
||||
63 Home Runs
|
||||
0.288 Batting Average
|
||||
|
||||
What a year!
|
@ -0,0 +1,8 @@
|
||||
name: Mark McGwire
|
||||
accomplishment: >
|
||||
Mark set a major league
|
||||
home run record in 1998.
|
||||
stats: |
|
||||
65 Home Runs
|
||||
0.278 Batting Average
|
||||
|
@ -0,0 +1,7 @@
|
||||
unicode: "Sosa did fine.\u263A"
|
||||
control: "\b1998\t1999\t2000\n"
|
||||
hex esc: "\x0d\x0a is \r\n"
|
||||
|
||||
single: '"Howdy!" he cried.'
|
||||
quoted: ' # Not a ''comment''.'
|
||||
tie-fighter: '|\-*-/|'
|
@ -0,0 +1,7 @@
|
||||
plain:
|
||||
This unquoted scalar
|
||||
spans many lines.
|
||||
|
||||
quoted: "So does this
|
||||
quoted scalar.\n"
|
||||
|
@ -0,0 +1,5 @@
|
||||
canonical: 12345
|
||||
decimal: +12345
|
||||
octal: 0o14
|
||||
hexadecimal: 0xC
|
||||
|
@ -0,0 +1,3 @@
|
||||
hr: 65 # Home runs
|
||||
avg: 0.278 # Batting average
|
||||
rbi: 147 # Runs Batted In
|
@ -0,0 +1,5 @@
|
||||
canonical: 1.23015e+3
|
||||
exponential: 12.3015e+02
|
||||
fixed: 1230.15
|
||||
negative infinity: -.inf
|
||||
not a number: .NaN
|
@ -0,0 +1,3 @@
|
||||
null:
|
||||
booleans: [ true, false ]
|
||||
string: '012345'
|
@ -0,0 +1,4 @@
|
||||
canonical: 2001-12-15T02:59:43.1Z
|
||||
iso8601: 2001-12-14t21:59:43.10-05:00
|
||||
spaced: 2001-12-14 21:59:43.10 -5
|
||||
date: 2002-12-14
|
@ -0,0 +1,14 @@
|
||||
---
|
||||
not-date: !!str 2002-04-28
|
||||
|
||||
picture: !!binary |
|
||||
R0lGODlhDAAMAIQAAP//9/X
|
||||
17unp5WZmZgAAAOfn515eXv
|
||||
Pz7Y6OjuDg4J+fn5OTk6enp
|
||||
56enmleECcgggoBADs=
|
||||
|
||||
application specific tag: !something |
|
||||
The semantics of the tag
|
||||
above may be different for
|
||||
different documents.
|
||||
|
@ -0,0 +1,14 @@
|
||||
%TAG ! tag:clarkevans.com,2002:
|
||||
--- !shape
|
||||
# Use the ! handle for presenting
|
||||
# tag:clarkevans.com,2002:circle
|
||||
- !circle
|
||||
center: &ORIGIN {x: 73, y: 129}
|
||||
radius: 7
|
||||
- !line
|
||||
start: *ORIGIN
|
||||
finish: { x: 89, y: 102 }
|
||||
- !label
|
||||
start: *ORIGIN
|
||||
color: 0xFFEEBB
|
||||
text: Pretty vector drawing.
|
@ -0,0 +1,7 @@
|
||||
# Sets are represented as a
|
||||
# Mapping where each key is
|
||||
# associated with a null value
|
||||
--- !!set
|
||||
? Mark McGwire
|
||||
? Sammy Sosa
|
||||
? Ken Griff
|
@ -0,0 +1,7 @@
|
||||
# Ordered maps are represented as
|
||||
# A sequence of mappings, with
|
||||
# each mapping having one key
|
||||
--- !!omap
|
||||
- Mark McGwire: 65
|
||||
- Sammy Sosa: 63
|
||||
- Ken Griffy: 58
|
@ -0,0 +1,29 @@
|
||||
--- !<tag:clarkevans.com,2002:invoice>
|
||||
invoice: 34843
|
||||
date : 2001-01-23
|
||||
bill-to: &id001
|
||||
given : Chris
|
||||
family : Dumars
|
||||
address:
|
||||
lines: |
|
||||
458 Walkman Dr.
|
||||
Suite #292
|
||||
city : Royal Oak
|
||||
state : MI
|
||||
postal : 48046
|
||||
ship-to: *id001
|
||||
product:
|
||||
- sku : BL394D
|
||||
quantity : 4
|
||||
description : Basketball
|
||||
price : 450.00
|
||||
- sku : BL4438H
|
||||
quantity : 1
|
||||
description : Super Hoop
|
||||
price : 2392.00
|
||||
tax : 251.42
|
||||
total: 4443.52
|
||||
comments:
|
||||
Late afternoon is best.
|
||||
Backup contact is Nancy
|
||||
Billsmer @ 338-4338.
|
@ -0,0 +1,29 @@
|
||||
---
|
||||
Time: 2001-11-23 15:01:42 -5
|
||||
User: ed
|
||||
Warning:
|
||||
This is an error message
|
||||
for the log file
|
||||
---
|
||||
Time: 2001-11-23 15:02:31 -5
|
||||
User: ed
|
||||
Warning:
|
||||
A slightly different error
|
||||
message.
|
||||
---
|
||||
Date: 2001-11-23 15:03:17 -5
|
||||
User: ed
|
||||
Fatal:
|
||||
Unknown variable "bar"
|
||||
Stack:
|
||||
- file: TopClass.py
|
||||
line: 23
|
||||
code: |
|
||||
x = MoreObject("345\n")
|
||||
- file: MoreClass.py
|
||||
line: 58
|
||||
code: |-
|
||||
foo = bar
|
||||
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
american:
|
||||
- Boston Red Sox
|
||||
- Detroit Tigers
|
||||
- New York Yankees
|
||||
national:
|
||||
- New York Mets
|
||||
- Chicago Cubs
|
||||
- Atlanta Braves
|
@ -0,0 +1,8 @@
|
||||
-
|
||||
name: Mark McGwire
|
||||
hr: 65
|
||||
avg: 0.278
|
||||
-
|
||||
name: Sammy Sosa
|
||||
hr: 63
|
||||
avg: 0.288
|
@ -0,0 +1,5 @@
|
||||
- [name , hr, avg ]
|
||||
- [Mark McGwire, 65, 0.278]
|
||||
- [Sammy Sosa , 63, 0.288]
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
Mark McGwire: {hr: 65, avg: 0.278}
|
||||
Sammy Sosa: {
|
||||
hr: 63,
|
||||
avg: 0.288
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# Ranking of 1998 home runs
|
||||
---
|
||||
- Mark McGwire
|
||||
- Sammy Sosa
|
||||
- Ken Griffey
|
||||
|
||||
# Team ranking
|
||||
---
|
||||
- Chicago Cubs
|
||||
- St Louis Cardinals
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
time: 20:03:20
|
||||
player: Sammy Sosa
|
||||
action: strike (miss)
|
||||
...
|
||||
---
|
||||
time: 20:03:47
|
||||
player: Sammy Sosa
|
||||
action: grand slam
|
||||
...
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
hr: # 1998 hr ranking
|
||||
- Mark McGwire
|
||||
- Sammy Sosa
|
||||
rbi:
|
||||
# 1998 rbi ranking
|
||||
- Sammy Sosa
|
||||
- Ken Griffey
|
@ -0,0 +1 @@
|
||||
# Comment only.
|
@ -0,0 +1,2 @@
|
||||
commercial-at: @text
|
||||
grave-accent: `text
|
@ -0,0 +1,3 @@
|
||||
|
|
||||
Line break (no glyph)
|
||||
Line break (glyphed)
|
@ -0,0 +1,6 @@
|
||||
# Tabs and spaces
|
||||
quoted: "Quoted "
|
||||
block: |
|
||||
void main() {
|
||||
printf("Hello, world!\n");
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
Bad escapes:
|
||||
"\c
|
||||
\xq-"
|
@ -0,0 +1,3 @@
|
||||
- Invalid use of BOM
|
||||
|
||||
- Inside a document.
|
@ -0,0 +1,7 @@
|
||||
sequence:
|
||||
- one
|
||||
- two
|
||||
mapping:
|
||||
? sky
|
||||
: blue
|
||||
sea : green
|
@ -0,0 +1,2 @@
|
||||
sequence: [ one, two, ]
|
||||
mapping: { sky: blue, sea: green }
|
@ -0,0 +1 @@
|
||||
# Comment only.
|
@ -0,0 +1,2 @@
|
||||
anchored: !local &anchor value
|
||||
alias: *anchor
|
@ -0,0 +1,6 @@
|
||||
literal: |
|
||||
some
|
||||
text
|
||||
folded: >
|
||||
some
|
||||
text
|
@ -0,0 +1,2 @@
|
||||
single: 'text'
|
||||
double: "text"
|
@ -0,0 +1,2 @@
|
||||
%YAML 1.2
|
||||
--- text
|
@ -0,0 +1,12 @@
|
||||
# Leading comment line spaces are
|
||||
# neither content nor indentation.
|
||||
|
||||
Not indented:
|
||||
By one space: |
|
||||
By four
|
||||
spaces
|
||||
Flow style: [ # Leading spaces
|
||||
By two, # in flow style
|
||||
Also by two, # are neither
|
||||
Still by two # content nor
|
||||
] # indentation.
|
@ -0,0 +1,3 @@
|
||||
# Comment
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
key: # Comment
|
||||
# lines
|
||||
value
|
||||
|
@ -0,0 +1,6 @@
|
||||
{ first: Sammy, last: Sosa }:
|
||||
# Statistics:
|
||||
hr: # Home runs
|
||||
65
|
||||
avg: # Average
|
||||
0.278
|
@ -0,0 +1,3 @@
|
||||
%FOO bar baz # Should be ignored
|
||||
# with a warning.
|
||||
--- "foo"
|
@ -0,0 +1,4 @@
|
||||
%YAML 1.3 # Attempt parsing
|
||||
# with a warning
|
||||
---
|
||||
"foo"
|
@ -0,0 +1,3 @@
|
||||
%YAML 1.2
|
||||
%YAML 1.1
|
||||
foo
|
@ -0,0 +1,3 @@
|
||||
%TAG !yaml! tag:yaml.org,2002:
|
||||
---
|
||||
!yaml!str "foo"
|
@ -0,0 +1,3 @@
|
||||
%TAG ! !foo
|
||||
%TAG ! !foo
|
||||
bar
|
@ -0,0 +1,7 @@
|
||||
# Private
|
||||
!foo "bar"
|
||||
...
|
||||
# Global
|
||||
%TAG ! tag:example.com,2000:app/
|
||||
---
|
||||
!foo "bar"
|
@ -0,0 +1,3 @@
|
||||
%TAG !! tag:example.com,2000:app/
|
||||
---
|
||||
!!int 1 - 3 # Interval, not integer
|
@ -0,0 +1,4 @@
|
||||
? a
|
||||
: - b
|
||||
- - c
|
||||
- d
|
@ -0,0 +1,3 @@
|
||||
%TAG !e! tag:example.com,2000:app/
|
||||
---
|
||||
!e!foo "bar"
|
@ -0,0 +1,7 @@
|
||||
%TAG !m! !my-
|
||||
--- # Bulb here
|
||||
!m!light fluorescent
|
||||
...
|
||||
%TAG !m! !my-
|
||||
--- # Color here
|
||||
!m!light green
|
@ -0,0 +1,3 @@
|
||||
%TAG !e! tag:example.com,2000:app/
|
||||
---
|
||||
- !e!foo "bar"
|
@ -0,0 +1,3 @@
|
||||
!!str &a1 "foo":
|
||||
!!str bar
|
||||
&a2 baz : *a1
|
@ -0,0 +1,2 @@
|
||||
!<tag:yaml.org,2002:str> foo :
|
||||
!<!bar> baz
|
@ -0,0 +1,2 @@
|
||||
- !<!> foo
|
||||
- !<$:?> bar
|
@ -0,0 +1,5 @@
|
||||
%TAG !e! tag:example.com,2000:app/
|
||||
---
|
||||
- !local foo
|
||||
- !!str bar
|
||||
- !e!tag%21 baz
|
@ -0,0 +1,4 @@
|
||||
%TAG !e! tag:example,2000:app/
|
||||
---
|
||||
- !e! foo
|
||||
- !h!bar baz
|
@ -0,0 +1,4 @@
|
||||
# Assuming conventional resolution:
|
||||
- "12"
|
||||
- 12
|
||||
- ! 12
|
@ -0,0 +1,2 @@
|
||||
First occurrence: &anchor Value
|
||||
Second occurrence: *anchor
|
@ -0,0 +1,3 @@
|
||||
- foo: bar
|
||||
- - baz
|
||||
- baz
|
@ -0,0 +1,7 @@
|
||||
plain: text
|
||||
lines
|
||||
quoted: "text
|
||||
lines"
|
||||
block: |
|
||||
text
|
||||
lines
|
@ -0,0 +1,7 @@
|
||||
Folding:
|
||||
"Empty line
|
||||
|
||||
as a line feed"
|
||||
Chomping: |
|
||||
Clipped empty lines
|
||||
|
@ -0,0 +1,7 @@
|
||||
>-
|
||||
trimmed
|
||||
|
||||
|
||||
|
||||
as
|
||||
space
|
@ -0,0 +1,6 @@
|
||||
>
|
||||
foo
|
||||
|
||||
bar
|
||||
|
||||
baz
|
@ -0,0 +1,7 @@
|
||||
"
|
||||
foo
|
||||
|
||||
bar
|
||||
|
||||
baz
|
||||
"
|
@ -0,0 +1,2 @@
|
||||
key: # Comment
|
||||
valueeof
|
@ -0,0 +1,4 @@
|
||||
First occurrence: &anchor Foo
|
||||
Second occurrence: *anchor
|
||||
Override anchor: &anchor Bar
|
||||
Reuse anchor: *anchor
|
@ -0,0 +1,12 @@
|
||||
# Outside flow collection:
|
||||
- ::vector
|
||||
- ": - ()"
|
||||
- Up, up, and away!
|
||||
- -123
|
||||
- http://example.com/foo#bar
|
||||
# Inside flow collection:
|
||||
- [ ::vector,
|
||||
": - ()",
|
||||
"Up, up and away!",
|
||||
-123,
|
||||
http://example.com/foo#bar ]
|
@ -0,0 +1,3 @@
|
||||
implicit block key : [
|
||||
implicit flow key : value,
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
1st non-empty
|
||||
|
||||
2nd non-empty
|
||||
3rd non-empty
|
@ -0,0 +1,2 @@
|
||||
- [ one, two, ]
|
||||
- [three ,four]
|
@ -0,0 +1,8 @@
|
||||
[
|
||||
"double
|
||||
quoted", 'single
|
||||
quoted',
|
||||
plain
|
||||
text, [ nested ],
|
||||
single: pair,
|
||||
]
|
@ -0,0 +1,2 @@
|
||||
- { one : two , three: four , }
|
||||
- {five: six,seven : eight}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
? explicit: entry,
|
||||
implicit: entry,
|
||||
?
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
unquoted : "separate",
|
||||
http://foo.com,
|
||||
omitted value:,
|
||||
: omitted key,
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"adjacent":value,
|
||||
"readable": value,
|
||||
"empty":
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
[
|
||||
foo: bar
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
foo : !!str,
|
||||
!!str : bar,
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
[
|
||||
? foo
|
||||
bar : baz
|
||||
]
|
@ -0,0 +1,3 @@
|
||||
- [ YAML : separate ]
|
||||
- [ : empty key entry ]
|
||||
- [ {JSON: like}:adjacent ]
|
@ -0,0 +1,3 @@
|
||||
[ foo
|
||||
bar: invalid,
|
||||
"foo...>1K characters...bar": invalid ]
|
@ -0,0 +1,5 @@
|
||||
- [ a, b ]
|
||||
- { a: b }
|
||||
- "a"
|
||||
- 'b'
|
||||
- c
|
@ -0,0 +1,5 @@
|
||||
- !!str "a"
|
||||
- 'b'
|
||||
- &anchor "c"
|
||||
- *anchor
|
||||
- !!str
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
? foo :,
|
||||
: bar,
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
"implicit block key" : [
|
||||
"implicit flow key" : value,
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue