dartfmt
diff --git a/lib/src/equality.dart b/lib/src/equality.dart
index 846f716..8867259 100644
--- a/lib/src/equality.dart
+++ b/lib/src/equality.dart
@@ -58,7 +58,7 @@
}
}
- /// Returns whether [list1] and [list2] are structurally equal.
+ /// Returns whether [list1] and [list2] are structurally equal.
bool _listEquals(List list1, List list2) {
if (list1.length != list2.length) return false;
@@ -69,7 +69,7 @@
return true;
}
- /// Returns whether [map1] and [map2] are structurally equal.
+ /// Returns whether [map1] and [map2] are structurally equal.
bool _mapEquals(Map map1, Map map2) {
if (map1.length != map2.length) return false;
diff --git a/lib/src/event.dart b/lib/src/event.dart
index a78c6ea..296df22 100644
--- a/lib/src/event.dart
+++ b/lib/src/event.dart
@@ -35,8 +35,10 @@
/// `===` sequence).
final bool isImplicit;
- DocumentStartEvent(this.span, {this.versionDirective,
- List<TagDirective> tagDirectives, this.isImplicit: true})
+ DocumentStartEvent(this.span,
+ {this.versionDirective,
+ List<TagDirective> tagDirectives,
+ this.isImplicit: true})
: tagDirectives = tagDirectives == null ? [] : tagDirectives;
String toString() => "DOCUMENT_START";
diff --git a/lib/src/loader.dart b/lib/src/loader.dart
index a2d681b..a756870 100644
--- a/lib/src/loader.dart
+++ b/lib/src/loader.dart
@@ -76,11 +76,16 @@
/// Composes a node.
YamlNode _loadNode(Event firstEvent) {
switch (firstEvent.type) {
- case EventType.ALIAS: return _loadAlias(firstEvent);
- case EventType.SCALAR: return _loadScalar(firstEvent);
- case EventType.SEQUENCE_START: return _loadSequence(firstEvent);
- case EventType.MAPPING_START: return _loadMapping(firstEvent);
- default: throw "Unreachable";
+ case EventType.ALIAS:
+ return _loadAlias(firstEvent);
+ case EventType.SCALAR:
+ return _loadScalar(firstEvent);
+ case EventType.SEQUENCE_START:
+ return _loadSequence(firstEvent);
+ case EventType.MAPPING_START:
+ return _loadMapping(firstEvent);
+ default:
+ throw "Unreachable";
}
}
@@ -120,14 +125,15 @@
/// Composes a sequence node.
YamlNode _loadSequence(SequenceStartEvent firstEvent) {
- if (firstEvent.tag != "!" && firstEvent.tag != null &&
+ if (firstEvent.tag != "!" &&
+ firstEvent.tag != null &&
firstEvent.tag != "tag:yaml.org,2002:seq") {
throw new YamlException("Invalid tag for sequence.", firstEvent.span);
}
var children = <YamlNode>[];
- var node = new YamlList.internal(
- children, firstEvent.span, firstEvent.style);
+ var node =
+ new YamlList.internal(children, firstEvent.span, firstEvent.style);
_registerAnchor(firstEvent.anchor, node);
var event = _parser.parse();
@@ -142,14 +148,15 @@
/// Composes a mapping node.
YamlNode _loadMapping(MappingStartEvent firstEvent) {
- if (firstEvent.tag != "!" && firstEvent.tag != null &&
+ if (firstEvent.tag != "!" &&
+ firstEvent.tag != null &&
firstEvent.tag != "tag:yaml.org,2002:map") {
throw new YamlException("Invalid tag for mapping.", firstEvent.span);
}
var children = deepEqualsMap/*<dynamic, YamlNode>*/();
- var node = new YamlMap.internal(
- children, firstEvent.span, firstEvent.style);
+ var node =
+ new YamlMap.internal(children, firstEvent.span, firstEvent.style);
_registerAnchor(firstEvent.anchor, node);
var event = _parser.parse();
@@ -268,8 +275,8 @@
/// Parses a numeric scalar.
///
/// Returns `null` if parsing fails.
- YamlNode _parseNumber(ScalarEvent scalar, {bool allowInt: true,
- bool allowFloat: true}) {
+ YamlNode _parseNumber(ScalarEvent scalar,
+ {bool allowInt: true, bool allowFloat: true}) {
var value = _parseNumberValue(scalar.value,
allowInt: allowInt, allowFloat: allowFloat);
return value == null ? null : new YamlScalar.internal(value, scalar);
@@ -278,8 +285,8 @@
/// Parses the value of a number.
///
/// Returns the number if it's parsed successfully, or `null` if it's not.
- num _parseNumberValue(String contents, {bool allowInt: true,
- bool allowFloat: true}) {
+ num _parseNumberValue(String contents,
+ {bool allowInt: true, bool allowFloat: true}) {
assert(allowInt || allowFloat);
var firstChar = contents.codeUnitAt(0);
@@ -307,7 +314,8 @@
// Int or float starting with a digit or a +/- sign.
if ((firstChar >= $0 && firstChar <= $9) ||
((firstChar == $plus || firstChar == $minus) &&
- secondChar >= $0 && secondChar <= $9)) {
+ secondChar >= $0 &&
+ secondChar <= $9)) {
// Try to parse an int or, failing that, a double.
var result = null;
if (allowInt) {
diff --git a/lib/src/null_span.dart b/lib/src/null_span.dart
index 43ac685..eab4ec0 100644
--- a/lib/src/null_span.dart
+++ b/lib/src/null_span.dart
@@ -14,6 +14,5 @@
SourceLocation get end => start;
final text = "";
- NullSpan(sourceUrl)
- : start = new SourceLocation(0, sourceUrl: sourceUrl);
+ NullSpan(sourceUrl) : start = new SourceLocation(0, sourceUrl: sourceUrl);
}
diff --git a/lib/src/parser.dart b/lib/src/parser.dart
index df6ed75..24e9e02 100644
--- a/lib/src/parser.dart
+++ b/lib/src/parser.dart
@@ -214,8 +214,8 @@
_scanner.scan();
return new DocumentEndEvent(token.span, isImplicit: false);
} else {
- return new DocumentEndEvent(
- token.span.start.pointSpan(), isImplicit: true);
+ return new DocumentEndEvent(token.span.start.pointSpan(),
+ isImplicit: true);
}
}
@@ -305,8 +305,7 @@
_state = _states.removeLast();
_scanner.scan();
- return new ScalarEvent(
- span.expand(token.span), token.value, token.style,
+ return new ScalarEvent(span.expand(token.span), token.value, token.style,
anchor: anchor, tag: tag);
}
@@ -331,7 +330,6 @@
anchor: anchor, tag: tag);
}
-
if (block && token.type == TokenType.BLOCK_MAPPING_START) {
_state = _State.BLOCK_MAPPING_FIRST_KEY;
return new MappingStartEvent(
@@ -341,8 +339,7 @@
if (anchor != null || tag != null) {
_state = _states.removeLast();
- return new ScalarEvent(
- span, '', ScalarStyle.PLAIN,
+ return new ScalarEvent(span, '', ScalarStyle.PLAIN,
anchor: anchor, tag: tag);
}
@@ -514,8 +511,7 @@
if (token.type == TokenType.KEY) {
_state = _State.FLOW_SEQUENCE_ENTRY_MAPPING_KEY;
_scanner.scan();
- return new MappingStartEvent(
- token.span, CollectionStyle.FLOW);
+ return new MappingStartEvent(token.span, CollectionStyle.FLOW);
} else if (token.type != TokenType.FLOW_SEQUENCE_END) {
_states.add(_State.FLOW_SEQUENCE_ENTRY);
return _parseNode();
@@ -579,8 +575,8 @@
/// *
Event _parseFlowSequenceEntryMappingEnd() {
_state = _State.FLOW_SEQUENCE_ENTRY;
- return new Event(EventType.MAPPING_END,
- _scanner.peek().span.start.pointSpan());
+ return new Event(
+ EventType.MAPPING_END, _scanner.peek().span.start.pointSpan());
}
/// Parses the productions:
@@ -670,7 +666,7 @@
VersionDirective versionDirective;
var tagDirectives = <TagDirective>[];
while (token.type == TokenType.VERSION_DIRECTIVE ||
- token.type == TokenType.TAG_DIRECTIVE) {
+ token.type == TokenType.TAG_DIRECTIVE) {
if (token is VersionDirectiveToken) {
if (versionDirective != null) {
throw new YamlException("Duplicate %YAML directive.", token.span);
@@ -679,7 +675,7 @@
if (token.major != 1 || token.minor == 0) {
throw new YamlException(
"Incompatible YAML document. This parser only supports YAML 1.1 "
- "and 1.2.",
+ "and 1.2.",
token.span);
} else if (token.minor > 2) {
// TODO(nweiz): Print to stderr when issue 6943 is fixed and dart:io
@@ -699,11 +695,9 @@
}
_appendTagDirective(
- new TagDirective("!", "!"),
- token.span.start.pointSpan(),
+ new TagDirective("!", "!"), token.span.start.pointSpan(),
allowDuplicates: true);
- _appendTagDirective(
- new TagDirective("!!", "tag:yaml.org,2002:"),
+ _appendTagDirective(new TagDirective("!!", "tag:yaml.org,2002:"),
token.span.start.pointSpan(),
allowDuplicates: true);
diff --git a/lib/src/scanner.dart b/lib/src/scanner.dart
index 9bf8114..91556af 100644
--- a/lib/src/scanner.dart
+++ b/lib/src/scanner.dart
@@ -135,7 +135,7 @@
///
/// Entries in this list may be `null`, indicating that there is no valid
/// simple key for the associated level of nesting.
- ///
+ ///
/// When a ":" is parsed and there's a simple key available, a [TokenType.KEY]
/// token is inserted in [_tokens] before that key's token. This allows the
/// parser to tell that the key is intended to be a mapping key.
@@ -187,8 +187,8 @@
return true;
default:
return (char >= NUMBER_0 && char <= NUMBER_9) ||
- (char >= LETTER_A && char <= LETTER_Z) ||
- (char >= LETTER_CAP_A && char <= LETTER_CAP_Z);
+ (char >= LETTER_A && char <= LETTER_Z) ||
+ (char >= LETTER_CAP_A && char <= LETTER_CAP_Z);
}
}
@@ -222,8 +222,8 @@
var char = _scanner.peekChar();
if (char == null) return false;
return (char >= NUMBER_0 && char <= NUMBER_9) ||
- (char >= LETTER_A && char <= LETTER_F) ||
- (char >= LETTER_CAP_A && char <= LETTER_CAP_F);
+ (char >= LETTER_A && char <= LETTER_F) ||
+ (char >= LETTER_CAP_A && char <= LETTER_CAP_F);
}
/// Whether the character at the current position is a plain character.
@@ -248,9 +248,9 @@
return true;
default:
return (char >= 0x00020 && char <= 0x00007E) ||
- (char >= 0x000A0 && char <= 0x00D7FF) ||
- (char >= 0x0E000 && char <= 0x00FFFD) ||
- (char >= 0x10000 && char <= 0x10FFFF);
+ (char >= 0x000A0 && char <= 0x00D7FF) ||
+ (char >= 0x0E000 && char <= 0x00FFFD) ||
+ (char >= 0x10000 && char <= 0x10FFFF);
}
}
@@ -271,9 +271,9 @@
return true;
default:
return (char >= 0x00020 && char <= 0x00007E) ||
- (char >= 0x000A0 && char <= 0x00D7FF) ||
- (char >= 0x0E000 && char <= 0x00FFFD) ||
- (char >= 0x10000 && char <= 0x10FFFF);
+ (char >= 0x000A0 && char <= 0x00D7FF) ||
+ (char >= 0x0E000 && char <= 0x00FFFD) ||
+ (char >= 0x10000 && char <= 0x10FFFF);
}
}
@@ -282,7 +282,8 @@
///
/// If so, this sets the scanner's last match to that indicator.
bool get _isDocumentIndicator {
- return _scanner.column == 0 && _isBlankOrEndAt(3) &&
+ return _scanner.column == 0 &&
+ _isBlankOrEndAt(3) &&
(_scanner.matches('---') || _scanner.matches('...'));
}
@@ -300,8 +301,7 @@
var token = _tokens.removeFirst();
_tokenAvailable = false;
_tokensParsed++;
- _streamEndProduced = token is Token &&
- token.type == TokenType.STREAM_END;
+ _streamEndProduced = token is Token && token.type == TokenType.STREAM_END;
return token;
}
@@ -330,8 +330,8 @@
// If the current token could be a simple key, we need to scan more
// tokens until we determine whether it is or not. Otherwise we might
// not emit the `KEY` token before we emit the value of the key.
- if (!_simpleKeys.any((key) =>
- key != null && key.tokenNumber == _tokensParsed)) {
+ if (!_simpleKeys
+ .any((key) => key != null && key.tokenNumber == _tokensParsed)) {
break;
}
}
@@ -655,14 +655,11 @@
if (_inBlockContext) {
if (!_simpleKeyAllowed) {
throw new YamlException(
- "Block sequence entries are not allowed here.",
- _scanner.emptySpan);
+ "Block sequence entries are not allowed here.", _scanner.emptySpan);
}
_rollIndent(
- _scanner.column,
- TokenType.BLOCK_SEQUENCE_START,
- _scanner.location);
+ _scanner.column, TokenType.BLOCK_SEQUENCE_START, _scanner.location);
} else {
// It is an error for the '-' indicator to occur in the flow context, but
// we let the Parser detect and report it because it's able to point to
@@ -678,14 +675,12 @@
void _fetchKey() {
if (_inBlockContext) {
if (!_simpleKeyAllowed) {
- throw new YamlException("Mapping keys are not allowed here.",
- _scanner.emptySpan);
+ throw new YamlException(
+ "Mapping keys are not allowed here.", _scanner.emptySpan);
}
_rollIndent(
- _scanner.column,
- TokenType.BLOCK_MAPPING_START,
- _scanner.location);
+ _scanner.column, TokenType.BLOCK_MAPPING_START, _scanner.location);
}
// Simple keys are allowed after `?` in a block context.
@@ -705,9 +700,7 @@
// In the block context, we may need to add the
// [TokenType.BLOCK_MAPPING_START] token.
_rollIndent(
- simpleKey.column,
- TokenType.BLOCK_MAPPING_START,
- simpleKey.location,
+ simpleKey.column, TokenType.BLOCK_MAPPING_START, simpleKey.location,
tokenNumber: simpleKey.tokenNumber);
// Remove the simple key.
@@ -719,16 +712,14 @@
if (!_simpleKeyAllowed) {
throw new YamlException(
"Mapping values are not allowed here. Did you miss a colon "
- "earlier?",
+ "earlier?",
_scanner.emptySpan);
}
// If we're here, we've found the ':' indicator following a complex key.
_rollIndent(
- _scanner.column,
- TokenType.BLOCK_MAPPING_START,
- _scanner.location);
+ _scanner.column, TokenType.BLOCK_MAPPING_START, _scanner.location);
_simpleKeyAllowed = true;
} else if (_simpleKeyAllowed) {
// If we're here, we've found the ':' indicator with an empty key. This
@@ -798,7 +789,7 @@
// libyaml disallows tabs after "-", "?", or ":", but the spec allows
// them. See section 6.2: http://yaml.org/spec/1.2/spec.html#id2778241.
while (_scanner.peekChar() == SP ||
- ((!_inBlockContext || !afterLineBreak) &&
+ ((!_inBlockContext || !afterLineBreak) &&
_scanner.peekChar() == TAB)) {
_scanner.readChar();
}
@@ -830,7 +821,7 @@
/// %YAML 1.2 # a comment \n
/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/// %TAG !yaml! tag:yaml.org,2002: \n
- /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Token _scanDirective() {
var start = _scanner.state;
@@ -860,8 +851,7 @@
_skipComment();
if (!_isBreakOrEnd) {
- throw new YamlException(
- "Expected comment or line break after directive.",
+ throw new YamlException("Expected comment or line break after directive.",
_scanner.spanFrom(start));
}
@@ -967,11 +957,17 @@
var next = _scanner.peekChar();
if (name.isEmpty ||
- (!_isBlankOrEnd && next != QUESTION && next != COLON &&
- next != COMMA && next != RIGHT_SQUARE && next != RIGHT_CURLY &&
- next != PERCENT && next != AT && next != GRAVE_ACCENT)) {
- throw new YamlException("Expected alphanumeric character.",
- _scanner.emptySpan);
+ (!_isBlankOrEnd &&
+ next != QUESTION &&
+ next != COLON &&
+ next != COMMA &&
+ next != RIGHT_SQUARE &&
+ next != RIGHT_CURLY &&
+ next != PERCENT &&
+ next != AT &&
+ next != GRAVE_ACCENT)) {
+ throw new YamlException(
+ "Expected alphanumeric character.", _scanner.emptySpan);
}
if (anchor) {
@@ -1075,7 +1071,8 @@
// disallowed.
var start = _scanner.position;
var char = _scanner.peekChar();
- while (_isTagChar || (flowSeparators &&
+ while (_isTagChar ||
+ (flowSeparators &&
(char == COMMA || char == LEFT_SQUARE || char == RIGHT_SQUARE))) {
_scanner.readChar();
char = _scanner.peekChar();
@@ -1134,8 +1131,8 @@
// Check if we're at the end of the line.
if (!_isBreakOrEnd) {
- throw new YamlException("Expected comment or line break.",
- _scanner.emptySpan);
+ throw new YamlException(
+ "Expected comment or line break.", _scanner.emptySpan);
}
_skipLine();
@@ -1172,7 +1169,9 @@
trailingBlank = _isBlank;
// Check if we need to fold the leading line break.
- if (!literal && leadingBreak.isNotEmpty && !leadingBlank &&
+ if (!literal &&
+ leadingBreak.isNotEmpty &&
+ !leadingBlank &&
!trailingBlank) {
// Do we need to join the lines with a space?
if (trailingBreaks.isEmpty) buffer.writeCharCode(SP);
@@ -1270,7 +1269,8 @@
var leadingBlanks = false;
while (!_isBlankOrEnd) {
var char = _scanner.peekChar();
- if (singleQuote && char == SINGLE_QUOTE &&
+ if (singleQuote &&
+ char == SINGLE_QUOTE &&
_scanner.peekChar(1) == SINGLE_QUOTE) {
// An escaped single quote.
_scanner.readChar();
@@ -1350,8 +1350,8 @@
codeLength = 8;
break;
default:
- throw new YamlException("Unknown escape character.",
- _scanner.spanFrom(escapeStart));
+ throw new YamlException(
+ "Unknown escape character.", _scanner.spanFrom(escapeStart));
}
_scanner.readChar();
@@ -1372,8 +1372,7 @@
// Check the value and write the character.
if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
- throw new YamlException(
- "Invalid Unicode character escape code.",
+ throw new YamlException("Invalid Unicode character escape code.",
_scanner.spanFrom(escapeStart));
}
@@ -1480,7 +1479,8 @@
while (_isBlank || _isBreak) {
if (_isBlank) {
// Check for a tab character messing up the intendation.
- if (leadingBreak.isNotEmpty && _scanner.column < indent &&
+ if (leadingBreak.isNotEmpty &&
+ _scanner.column < indent &&
_scanner.peekChar() == TAB) {
_scanner.error("Expected a space but found a tab.", length: 1);
}
@@ -1508,8 +1508,8 @@
// Allow a simple key after a plain scalar with leading blanks.
if (leadingBreak.isNotEmpty) _simpleKeyAllowed = true;
- return new ScalarToken(_scanner.spanFrom(start, end), buffer.toString(),
- ScalarStyle.PLAIN);
+ return new ScalarToken(
+ _scanner.spanFrom(start, end), buffer.toString(), ScalarStyle.PLAIN);
}
/// Moves past the current line break, if there is one.
@@ -1554,7 +1554,10 @@
// the source.
bool _isBlankOrEndAt(int offset) {
var char = _scanner.peekChar(offset);
- return char == null || char == SP || char == TAB || char == CR ||
+ return char == null ||
+ char == SP ||
+ char == TAB ||
+ char == CR ||
char == LF;
}
@@ -1597,10 +1600,10 @@
return true;
default:
return char != null &&
- ((char >= 0x00020 && char <= 0x00007E) ||
- (char >= 0x000A0 && char <= 0x00D7FF) ||
- (char >= 0x0E000 && char <= 0x00FFFD) ||
- (char >= 0x10000 && char <= 0x10FFFF));
+ ((char >= 0x00020 && char <= 0x00007E) ||
+ (char >= 0x000A0 && char <= 0x00D7FF) ||
+ (char >= 0x0E000 && char <= 0x00FFFD) ||
+ (char >= 0x10000 && char <= 0x10FFFF));
}
}
@@ -1657,7 +1660,7 @@
final bool required;
_SimpleKey(this.tokenNumber, this.line, this.column, this.location,
- {bool required})
+ {bool required})
: required = required;
}
diff --git a/lib/src/style.dart b/lib/src/style.dart
index d235404..30082cf 100644
--- a/lib/src/style.dart
+++ b/lib/src/style.dart
@@ -19,7 +19,6 @@
/// See http://yaml.org/spec/1.2/spec.html#id2795688.
static const LITERAL = const ScalarStyle._("LITERAL");
-
/// The folded scalar style, with a `>` prefix.
///
/// See http://yaml.org/spec/1.2/spec.html#id2796251.
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index c1a58e4..36e4e93 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -38,5 +38,3 @@
if (span != null) message = span.message(message);
print(message);
};
-
-
diff --git a/lib/src/yaml_document.dart b/lib/src/yaml_document.dart
index 61a82e7..b373223 100644
--- a/lib/src/yaml_document.dart
+++ b/lib/src/yaml_document.dart
@@ -31,8 +31,8 @@
/// Users of the library should not use this constructor.
YamlDocument.internal(this.contents, this.span, this.versionDirective,
- List<TagDirective> tagDirectives, {this.startImplicit: false,
- this.endImplicit: false})
+ List<TagDirective> tagDirectives,
+ {this.startImplicit: false, this.endImplicit: false})
: tagDirectives = new UnmodifiableListView(tagDirectives);
String toString() => contents.toString();
diff --git a/lib/src/yaml_exception.dart b/lib/src/yaml_exception.dart
index 04067ee..c4b7f28 100644
--- a/lib/src/yaml_exception.dart
+++ b/lib/src/yaml_exception.dart
@@ -6,7 +6,5 @@
/// An error thrown by the YAML processor.
class YamlException extends SourceSpanFormatException {
- YamlException(String message, SourceSpan span)
- : super(message, span);
+ YamlException(String message, SourceSpan span) : super(message, span);
}
-
diff --git a/lib/src/yaml_node.dart b/lib/src/yaml_node.dart
index 2b615d3..7190c81 100644
--- a/lib/src/yaml_node.dart
+++ b/lib/src/yaml_node.dart
@@ -39,7 +39,7 @@
}
/// A read-only [Map] parsed from YAML.
-class YamlMap extends YamlNode with collection.MapMixin, UnmodifiableMapMixin {
+class YamlMap extends YamlNode with collection.MapMixin, UnmodifiableMapMixin {
/// A view of [this] where the keys and values are guaranteed to be
/// [YamlNode]s.
///
@@ -64,8 +64,7 @@
/// is passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
- factory YamlMap({sourceUrl}) =>
- new YamlMapWrapper(const {}, sourceUrl);
+ factory YamlMap({sourceUrl}) => new YamlMapWrapper(const {}, sourceUrl);
/// Wraps a Dart map so that it can be accessed (recursively) like a
/// [YamlMap].
@@ -114,8 +113,7 @@
/// [sourceUrl] is passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
- factory YamlList({sourceUrl}) =>
- new YamlListWrapper(const [], sourceUrl);
+ factory YamlList({sourceUrl}) => new YamlListWrapper(const [], sourceUrl);
/// Wraps a Dart list so that it can be accessed (recursively) like a
/// [YamlList].
@@ -156,14 +154,12 @@
/// [sourceUrl] is passed, it's used as the [SourceSpan.sourceUrl].
///
/// [sourceUrl] may be either a [String], a [Uri], or `null`.
- YamlScalar.wrap(this.value, {sourceUrl})
- : style = ScalarStyle.ANY {
+ YamlScalar.wrap(this.value, {sourceUrl}) : style = ScalarStyle.ANY {
_span = new NullSpan(sourceUrl);
}
/// Users of the library should not use this constructor.
- YamlScalar.internal(this.value, ScalarEvent scalar)
- : style = scalar.style {
+ YamlScalar.internal(this.value, ScalarEvent scalar) : style = scalar.style {
_span = scalar.span;
}
diff --git a/lib/src/yaml_node_wrapper.dart b/lib/src/yaml_node_wrapper.dart
index a0922ed..bcb0faa 100644
--- a/lib/src/yaml_node_wrapper.dart
+++ b/lib/src/yaml_node_wrapper.dart
@@ -56,8 +56,8 @@
final SourceSpan _span;
- Iterable get keys => _dartMap.keys.map((key) =>
- new YamlScalar.internalWithSpan(key, _span));
+ Iterable get keys =>
+ _dartMap.keys.map((key) => new YamlScalar.internalWithSpan(key, _span));
_YamlMapNodes(this._dartMap, this._span);
diff --git a/lib/yaml.dart b/lib/yaml.dart
index 9772464..13d6dc2 100644
--- a/lib/yaml.dart
+++ b/lib/yaml.dart
@@ -52,7 +52,8 @@
if (document == null) {
return new YamlDocument.internal(
new YamlScalar.internalWithSpan(null, loader.span),
- loader.span, null, const []);
+ loader.span,
+ null, const []);
}
var nextDocument = loader.load();
diff --git a/test/utils.dart b/test/utils.dart
index e1d4b64..f720387 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -12,8 +12,8 @@
/// Returns a matcher that asserts that the value equals [expected].
///
/// This handles recursive loops and considers `NaN` to equal itself.
-Matcher deepEquals(expected) => predicate((actual) =>
- equality.deepEquals(actual, expected), "equals $expected");
+Matcher deepEquals(expected) => predicate(
+ (actual) => equality.deepEquals(actual, expected), "equals $expected");
/// Constructs a new yaml.YamlMap, optionally from a normal Map.
Map deepEqualsMap([Map from]) {
diff --git a/test/yaml_node_wrapper_test.dart b/test/yaml_node_wrapper_test.dart
index 8cb8cfa..5d9a102 100644
--- a/test/yaml_node_wrapper_test.dart
+++ b/test/yaml_node_wrapper_test.dart
@@ -41,14 +41,16 @@
"scalar": "value"
});
- expect(map, equals({
- "list": [1, 2, 3],
- "map": {
- "foo": "bar",
- "nested": [4, 5, 6]
- },
- "scalar": "value"
- }));
+ expect(
+ map,
+ equals({
+ "list": [1, 2, 3],
+ "map": {
+ "foo": "bar",
+ "nested": [4, 5, 6]
+ },
+ "scalar": "value"
+ }));
expect(map.span, isNullSpan(isNull));
expect(map["list"], new isInstanceOf<YamlList>());
@@ -94,14 +96,16 @@
"value"
]);
- expect(list, equals([
- [1, 2, 3],
- {
- "foo": "bar",
- "nested": [4, 5, 6]
- },
- "value"
- ]));
+ expect(
+ list,
+ equals([
+ [1, 2, 3],
+ {
+ "foo": "bar",
+ "nested": [4, 5, 6]
+ },
+ "value"
+ ]));
expect(list.span, isNullSpan(isNull));
expect(list[0], new isInstanceOf<YamlList>());
@@ -149,13 +153,13 @@
}
Matcher isNullSpan(sourceUrl) => predicate((span) {
- expect(span, new isInstanceOf<SourceSpan>());
- expect(span.length, equals(0));
- expect(span.text, isEmpty);
- expect(span.start, equals(span.end));
- expect(span.start.offset, equals(0));
- expect(span.start.line, equals(0));
- expect(span.start.column, equals(0));
- expect(span.sourceUrl, sourceUrl);
- return true;
-});
+ expect(span, new isInstanceOf<SourceSpan>());
+ expect(span.length, equals(0));
+ expect(span.text, isEmpty);
+ expect(span.start, equals(span.end));
+ expect(span.start.offset, equals(0));
+ expect(span.start.line, equals(0));
+ expect(span.start.column, equals(0));
+ expect(span.sourceUrl, sourceUrl);
+ return true;
+ });
diff --git a/test/yaml_test.dart b/test/yaml_test.dart
index 8dee6c6..acddf5f 100644
--- a/test/yaml_test.dart
+++ b/test/yaml_test.dart
@@ -16,16 +16,14 @@
e.toString().contains('Tab characters are not allowed as indentation'));
test('using a tab as indentation', () {
- expect(() => loadYaml('foo:\n\tbar'),
- throwsA(tabError));
+ expect(() => loadYaml('foo:\n\tbar'), throwsA(tabError));
});
test('using a tab not as indentation', () {
expect(() => loadYaml('''
"foo
\tbar"
- error'''),
- throwsA(isNot(tabError)));
+ error'''), throwsA(isNot(tabError)));
});
});
@@ -115,27 +113,34 @@
// the spec.
group('2.1: Collections', () {
test('[Example 2.1]', () {
- expectYamlLoads(["Mark McGwire", "Sammy Sosa", "Ken Griffey"],
- """
+ expectYamlLoads(
+ ["Mark McGwire", "Sammy Sosa", "Ken Griffey"],
+ """
- Mark McGwire
- Sammy Sosa
- Ken Griffey""");
});
test('[Example 2.2]', () {
- expectYamlLoads({"hr": 65, "avg": 0.278, "rbi": 147},
- """
+ expectYamlLoads(
+ {"hr": 65, "avg": 0.278, "rbi": 147},
+ """
hr: 65 # Home runs
avg: 0.278 # Batting average
rbi: 147 # Runs Batted In""");
});
test('[Example 2.3]', () {
- expectYamlLoads({
- "american": ["Boston Red Sox", "Detroit Tigers", "New York Yankees"],
- "national": ["New York Mets", "Chicago Cubs", "Atlanta Braves"],
- },
- """
+ expectYamlLoads(
+ {
+ "american": [
+ "Boston Red Sox",
+ "Detroit Tigers",
+ "New York Yankees"
+ ],
+ "national": ["New York Mets", "Chicago Cubs", "Atlanta Braves"],
+ },
+ """
american:
- Boston Red Sox
- Detroit Tigers
@@ -147,11 +152,12 @@
});
test('[Example 2.4]', () {
- expectYamlLoads([
- {"name": "Mark McGwire", "hr": 65, "avg": 0.278},
- {"name": "Sammy Sosa", "hr": 63, "avg": 0.288},
- ],
- """
+ expectYamlLoads(
+ [
+ {"name": "Mark McGwire", "hr": 65, "avg": 0.278},
+ {"name": "Sammy Sosa", "hr": 63, "avg": 0.288},
+ ],
+ """
-
name: Mark McGwire
hr: 65
@@ -163,23 +169,25 @@
});
test('[Example 2.5]', () {
- expectYamlLoads([
- ["name", "hr", "avg"],
- ["Mark McGwire", 65, 0.278],
- ["Sammy Sosa", 63, 0.288]
- ],
- """
+ expectYamlLoads(
+ [
+ ["name", "hr", "avg"],
+ ["Mark McGwire", 65, 0.278],
+ ["Sammy Sosa", 63, 0.288]
+ ],
+ """
- [name , hr, avg ]
- [Mark McGwire, 65, 0.278]
- [Sammy Sosa , 63, 0.288]""");
});
test('[Example 2.6]', () {
- expectYamlLoads({
- "Mark McGwire": {"hr": 65, "avg": 0.278},
- "Sammy Sosa": {"hr": 63, "avg": 0.288}
- },
- """
+ expectYamlLoads(
+ {
+ "Mark McGwire": {"hr": 65, "avg": 0.278},
+ "Sammy Sosa": {"hr": 63, "avg": 0.288}
+ },
+ """
Mark McGwire: {hr: 65, avg: 0.278}
Sammy Sosa: {
hr: 63,
@@ -190,11 +198,12 @@
group('2.2: Structures', () {
test('[Example 2.7]', () {
- expectYamlStreamLoads([
- ["Mark McGwire", "Sammy Sosa", "Ken Griffey"],
- ["Chicago Cubs", "St Louis Cardinals"]
- ],
- """
+ expectYamlStreamLoads(
+ [
+ ["Mark McGwire", "Sammy Sosa", "Ken Griffey"],
+ ["Chicago Cubs", "St Louis Cardinals"]
+ ],
+ """
# Ranking of 1998 home runs
---
- Mark McGwire
@@ -208,11 +217,20 @@
});
test('[Example 2.8]', () {
- expectYamlStreamLoads([
- {"time": "20:03:20", "player": "Sammy Sosa", "action": "strike (miss)"},
- {"time": "20:03:47", "player": "Sammy Sosa", "action": "grand slam"},
- ],
- """
+ expectYamlStreamLoads(
+ [
+ {
+ "time": "20:03:20",
+ "player": "Sammy Sosa",
+ "action": "strike (miss)"
+ },
+ {
+ "time": "20:03:47",
+ "player": "Sammy Sosa",
+ "action": "grand slam"
+ },
+ ],
+ """
---
time: 20:03:20
player: Sammy Sosa
@@ -226,11 +244,12 @@
});
test('[Example 2.9]', () {
- expectYamlLoads({
- "hr": ["Mark McGwire", "Sammy Sosa"],
- "rbi": ["Sammy Sosa", "Ken Griffey"]
- },
- """
+ expectYamlLoads(
+ {
+ "hr": ["Mark McGwire", "Sammy Sosa"],
+ "rbi": ["Sammy Sosa", "Ken Griffey"]
+ },
+ """
---
hr: # 1998 hr ranking
- Mark McGwire
@@ -242,11 +261,12 @@
});
test('[Example 2.10]', () {
- expectYamlLoads({
- "hr": ["Mark McGwire", "Sammy Sosa"],
- "rbi": ["Sammy Sosa", "Ken Griffey"]
- },
- """
+ expectYamlLoads(
+ {
+ "hr": ["Mark McGwire", "Sammy Sosa"],
+ "rbi": ["Sammy Sosa", "Ken Griffey"]
+ },
+ """
---
hr:
- Mark McGwire
@@ -260,10 +280,14 @@
test('[Example 2.11]', () {
var doc = deepEqualsMap();
doc[["Detroit Tigers", "Chicago cubs"]] = ["2001-07-23"];
- doc[["New York Yankees", "Atlanta Braves"]] =
- ["2001-07-02", "2001-08-12", "2001-08-14"];
- expectYamlLoads(doc,
- """
+ doc[["New York Yankees", "Atlanta Braves"]] = [
+ "2001-07-02",
+ "2001-08-12",
+ "2001-08-14"
+ ];
+ expectYamlLoads(
+ doc,
+ """
? - Detroit Tigers
- Chicago cubs
:
@@ -276,12 +300,13 @@
});
test('[Example 2.12]', () {
- expectYamlLoads([
- {"item": "Super Hoop", "quantity": 1},
- {"item": "Basketball", "quantity": 4},
- {"item": "Big Shoes", "quantity": 1},
- ],
- """
+ expectYamlLoads(
+ [
+ {"item": "Super Hoop", "quantity": 1},
+ {"item": "Basketball", "quantity": 4},
+ {"item": "Big Shoes", "quantity": 1},
+ ],
+ """
---
# Products purchased
- item : Super Hoop
@@ -296,11 +321,10 @@
group('2.3: Scalars', () {
test('[Example 2.13]', () {
expectYamlLoads(
- cleanUpLiteral(
- """
+ cleanUpLiteral("""
\\//||\\/||
// || ||__"""),
- """
+ """
# ASCII Art
--- |
\\//||\\/||
@@ -308,8 +332,9 @@
});
test('[Example 2.14]', () {
- expectYamlLoads("Mark McGwire's year was crippled by a knee injury.",
- """
+ expectYamlLoads(
+ "Mark McGwire's year was crippled by a knee injury.",
+ """
--- >
Mark McGwire's
year was crippled
@@ -318,15 +343,14 @@
test('[Example 2.15]', () {
expectYamlLoads(
- cleanUpLiteral(
- """
+ cleanUpLiteral("""
Sammy Sosa completed another fine season with great stats.
63 Home Runs
0.288 Batting Average
What a year!"""),
- """
+ """
>
Sammy Sosa completed another
fine season with great stats.
@@ -338,12 +362,14 @@
});
test('[Example 2.16]', () {
- expectYamlLoads({
- "name": "Mark McGwire",
- "accomplishment": "Mark set a major league home run record in 1998.\n",
- "stats": "65 Home Runs\n0.278 Batting Average"
- },
- """
+ expectYamlLoads(
+ {
+ "name": "Mark McGwire",
+ "accomplishment":
+ "Mark set a major league home run record in 1998.\n",
+ "stats": "65 Home Runs\n0.278 Batting Average"
+ },
+ """
name: Mark McGwire
accomplishment: >
Mark set a major league
@@ -354,15 +380,16 @@
});
test('[Example 2.17]', () {
- expectYamlLoads({
- "unicode": "Sosa did fine.\u263A",
- "control": "\b1998\t1999\t2000\n",
- "hex esc": "\r\n is \r\n",
- "single": '"Howdy!" he cried.',
- "quoted": " # Not a 'comment'.",
- "tie-fighter": "|\\-*-/|"
- },
- """
+ expectYamlLoads(
+ {
+ "unicode": "Sosa did fine.\u263A",
+ "control": "\b1998\t1999\t2000\n",
+ "hex esc": "\r\n is \r\n",
+ "single": '"Howdy!" he cried.',
+ "quoted": " # Not a 'comment'.",
+ "tie-fighter": "|\\-*-/|"
+ },
+ """
unicode: "Sosa did fine.\\u263A"
control: "\\b1998\\t1999\\t2000\\n"
hex esc: "\\x0d\\x0a is \\r\\n"
@@ -373,11 +400,12 @@
});
test('[Example 2.18]', () {
- expectYamlLoads({
- "plain": "This unquoted scalar spans many lines.",
- "quoted": "So does this quoted scalar.\n"
- },
- '''
+ expectYamlLoads(
+ {
+ "plain": "This unquoted scalar spans many lines.",
+ "quoted": "So does this quoted scalar.\n"
+ },
+ '''
plain:
This unquoted scalar
spans many lines.
@@ -389,13 +417,14 @@
group('2.4: Tags', () {
test('[Example 2.19]', () {
- expectYamlLoads({
- "canonical": 12345,
- "decimal": 12345,
- "octal": 12,
- "hexadecimal": 12
- },
- """
+ expectYamlLoads(
+ {
+ "canonical": 12345,
+ "decimal": 12345,
+ "octal": 12,
+ "hexadecimal": 12
+ },
+ """
canonical: 12345
decimal: +12345
octal: 0o14
@@ -403,14 +432,15 @@
});
test('[Example 2.20]', () {
- expectYamlLoads({
- "canonical": 1230.15,
- "exponential": 1230.15,
- "fixed": 1230.15,
- "negative infinity": -infinity,
- "not a number": nan
- },
- """
+ expectYamlLoads(
+ {
+ "canonical": 1230.15,
+ "exponential": 1230.15,
+ "fixed": 1230.15,
+ "negative infinity": -infinity,
+ "not a number": nan
+ },
+ """
canonical: 1.23015e+3
exponential: 12.3015e+02
fixed: 1230.15
@@ -424,8 +454,9 @@
"string": "012345"
});
doc[null] = null;
- expectYamlLoads(doc,
- """
+ expectYamlLoads(
+ doc,
+ """
null:
booleans: [ true, false ]
string: '012345'""");
@@ -440,32 +471,33 @@
// doesn't plan to support.
test('[Example 2.28]', () {
- expectYamlStreamLoads([
- {
- "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."
- },
- {
- "DateTime": "2001-11-23 15:03:17 -5",
- "User": "ed",
- "Fatal": 'Unknown variable "bar"',
- "Stack": [
+ expectYamlStreamLoads(
+ [
{
- "file": "TopClass.py",
- "line": 23,
- "code": 'x = MoreObject("345\\n")\n'
+ "Time": "2001-11-23 15:01:42 -5",
+ "User": "ed",
+ "Warning": "This is an error message for the log file"
},
- {"file": "MoreClass.py", "line": 58, "code": "foo = bar"}
- ]
- }
- ],
- """
+ {
+ "Time": "2001-11-23 15:02:31 -5",
+ "User": "ed",
+ "Warning": "A slightly different error message."
+ },
+ {
+ "DateTime": "2001-11-23 15:03:17 -5",
+ "User": "ed",
+ "Fatal": 'Unknown variable "bar"',
+ "Stack": [
+ {
+ "file": "TopClass.py",
+ "line": 23,
+ "code": 'x = MoreObject("345\\n")\n'
+ },
+ {"file": "MoreClass.py", "line": 58, "code": "foo = bar"}
+ ]
+ }
+ ],
+ """
---
Time: 2001-11-23 15:01:42 -5
User: ed
@@ -550,11 +582,12 @@
group('5.3: Indicator Characters', () {
test('[Example 5.3]', () {
- expectYamlLoads({
- 'sequence': ['one', 'two'],
- 'mapping': {'sky': 'blue', 'sea': 'green'}
- },
- """
+ expectYamlLoads(
+ {
+ 'sequence': ['one', 'two'],
+ 'mapping': {'sky': 'blue', 'sea': 'green'}
+ },
+ """
sequence:
- one
- two
@@ -565,11 +598,12 @@
});
test('[Example 5.4]', () {
- expectYamlLoads({
- 'sequence': ['one', 'two'],
- 'mapping': {'sky': 'blue', 'sea': 'green'}
- },
- """
+ expectYamlLoads(
+ {
+ 'sequence': ['one', 'two'],
+ 'mapping': {'sky': 'blue', 'sea': 'green'}
+ },
+ """
sequence: [ one, two, ]
mapping: { sky: blue, sea: green }""");
});
@@ -579,11 +613,9 @@
// Skipping 5.6 because it uses an undefined tag.
test('[Example 5.7]', () {
- expectYamlLoads({
- 'literal': "some\ntext\n",
- 'folded': "some text\n"
- },
- """
+ expectYamlLoads(
+ {'literal': "some\ntext\n", 'folded': "some text\n"},
+ """
literal: |
some
text
@@ -594,19 +626,18 @@
});
test('[Example 5.8]', () {
- expectYamlLoads({
- 'single': "text",
- 'double': "text"
- },
- """
+ expectYamlLoads(
+ {'single': "text", 'double': "text"},
+ """
single: 'text'
double: "text"
""");
});
test('[Example 5.9]', () {
- expectYamlLoads("text",
- """
+ expectYamlLoads(
+ "text",
+ """
%YAML 1.2
--- text""");
});
@@ -631,18 +662,22 @@
});
group('in a scalar context must be normalized', () {
- test("from \\r to \\n", () =>
- expectYamlLoads(["foo\nbar"], indentLiteral('- |\n foo\r bar')));
- test("from \\r\\n to \\n", () =>
- expectYamlLoads(["foo\nbar"], indentLiteral('- |\n foo\r\n bar')));
+ test(
+ "from \\r to \\n",
+ () => expectYamlLoads(
+ ["foo\nbar"], indentLiteral('- |\n foo\r bar')));
+ test(
+ "from \\r\\n to \\n",
+ () => expectYamlLoads(
+ ["foo\nbar"], indentLiteral('- |\n foo\r\n bar')));
});
test('[Example 5.11]', () {
expectYamlLoads(
- cleanUpLiteral("""
+ cleanUpLiteral("""
Line break (no glyph)
Line break (glyphed)"""),
- """
+ """
|
Line break (no glyph)
Line break (glyphed)""");
@@ -651,11 +686,12 @@
group('5.5: White Space Characters', () {
test('[Example 5.12]', () {
- expectYamlLoads({
- "quoted": "Quoted \t",
- "block": 'void main() {\n\tprintf("Hello, world!\\n");\n}\n'
- },
- """
+ expectYamlLoads(
+ {
+ "quoted": "Quoted \t",
+ "block": 'void main() {\n\tprintf("Hello, world!\\n");\n}\n'
+ },
+ """
# Tabs and spaces
quoted: "Quoted \t"
block:\t|
@@ -669,12 +705,12 @@
group('5.7: Escaped Characters', () {
test('[Example 5.13]', () {
expectYamlLoads(
- "Fun with \x5C "
- "\x22 \x07 \x08 \x1B \x0C "
- "\x0A \x0D \x09 \x0B \x00 "
- "\x20 \xA0 \x85 \u2028 \u2029 "
- "A A A",
- '''
+ "Fun with \x5C "
+ "\x22 \x07 \x08 \x1B \x0C "
+ "\x0A \x0D \x09 \x0B \x00 "
+ "\x20 \xA0 \x85 \u2028 \u2029 "
+ "A A A",
+ '''
"Fun with \\\\
\\" \\a \\b \\e \\f \\
\\n \\r \\t \\v \\0 \\
@@ -691,24 +727,26 @@
// Chapter 6: Basic Structures
group('6.1: Indentation Spaces', () {
test('may not include TAB characters', () {
- expectYamlFails(
- """
+ expectYamlFails("""
-
\t- foo
\t- bar""");
});
test('must be the same for all sibling nodes', () {
- expectYamlFails(
- """
+ expectYamlFails("""
-
- foo
- bar""");
});
test('may be different for the children of sibling nodes', () {
- expectYamlLoads([["foo"], ["bar"]],
- """
+ expectYamlLoads(
+ [
+ ["foo"],
+ ["bar"]
+ ],
+ """
-
- foo
-
@@ -716,17 +754,14 @@
});
test('[Example 6.1]', () {
- expectYamlLoads({
- "Not indented": {
- "By one space": "By four\n spaces\n",
- "Flow style": [
- "By two",
- "Also by two",
- "Still by two"
- ]
- }
- },
- """
+ expectYamlLoads(
+ {
+ "Not indented": {
+ "By one space": "By four\n spaces\n",
+ "Flow style": ["By two", "Also by two", "Still by two"]
+ }
+ },
+ """
# Leading comment line spaces are
# neither content nor indentation.
@@ -742,8 +777,14 @@
});
test('[Example 6.2]', () {
- expectYamlLoads({'a': ['b', ['c', 'd']]},
- """
+ expectYamlLoads(
+ {
+ 'a': [
+ 'b',
+ ['c', 'd']
+ ]
+ },
+ """
? a
: -\tb
- -\tc
@@ -753,8 +794,12 @@
group('6.2: Separation Spaces', () {
test('[Example 6.3]', () {
- expectYamlLoads([{'foo': 'bar'}, ['baz', 'baz']],
- """
+ expectYamlLoads(
+ [
+ {'foo': 'bar'},
+ ['baz', 'baz']
+ ],
+ """
- foo:\t bar
- - baz
-\tbaz""");
@@ -763,12 +808,13 @@
group('6.3: Line Prefixes', () {
test('[Example 6.4]', () {
- expectYamlLoads({
- "plain": "text lines",
- "quoted": "text lines",
- "block": "text\n \tlines\n"
- },
- """
+ expectYamlLoads(
+ {
+ "plain": "text lines",
+ "quoted": "text lines",
+ "block": "text\n \tlines\n"
+ },
+ """
plain: text
lines
quoted: "text
@@ -782,11 +828,12 @@
group('6.4: Empty Lines', () {
test('[Example 6.5]', () {
- expectYamlLoads({
- "Folding": "Empty line\nas a line feed",
- "Chomping": "Clipped empty lines\n",
- },
- """
+ expectYamlLoads(
+ {
+ "Folding": "Empty line\nas a line feed",
+ "Chomping": "Clipped empty lines\n",
+ },
+ """
Folding:
"Empty line
\t
@@ -799,8 +846,9 @@
group('6.5: Line Folding', () {
test('[Example 6.6]', () {
- expectYamlLoads("trimmed\n\n\nas space",
- """
+ expectYamlLoads(
+ "trimmed\n\n\nas space",
+ """
>-
trimmed
@@ -812,8 +860,9 @@
});
test('[Example 6.7]', () {
- expectYamlLoads("foo \n\n\t bar\n\nbaz\n",
- """
+ expectYamlLoads(
+ "foo \n\n\t bar\n\nbaz\n",
+ """
>
foo
@@ -824,8 +873,9 @@
});
test('[Example 6.8]', () {
- expectYamlLoads(" foo\nbar\nbaz ",
- '''
+ expectYamlLoads(
+ " foo\nbar\nbaz ",
+ '''
"
foo
@@ -844,24 +894,29 @@
});
test('[Example 6.9]', () {
- expectYamlLoads({'key': 'value'},
- """
+ expectYamlLoads(
+ {'key': 'value'},
+ """
key: # Comment
value""");
});
group('outside of scalar content', () {
test('may appear on a line of their own', () {
- expectYamlLoads([1, 2],
- """
+ expectYamlLoads(
+ [1, 2],
+ """
- 1
# Comment
- 2""");
});
test('are independent of indentation level', () {
- expectYamlLoads([[1, 2]],
- """
+ expectYamlLoads(
+ [
+ [1, 2]
+ ],
+ """
-
- 1
# Comment
@@ -869,8 +924,9 @@
});
test('include lines containing only white space characters', () {
- expectYamlLoads([1, 2],
- """
+ expectYamlLoads(
+ [1, 2],
+ """
- 1
\t
- 2""");
@@ -879,8 +935,9 @@
group('within scalar content', () {
test('may not appear on a line of their own', () {
- expectYamlLoads(["foo\n# not comment\nbar\n"],
- """
+ expectYamlLoads(
+ ["foo\n# not comment\nbar\n"],
+ """
- |
foo
# not comment
@@ -889,8 +946,9 @@
});
test("don't include lines containing only white space characters", () {
- expectYamlLoads(["foo\n \t \nbar\n"],
- """
+ expectYamlLoads(
+ ["foo\n \t \nbar\n"],
+ """
- |
foo
\t
@@ -900,16 +958,18 @@
});
test('[Example 6.10]', () {
- expectYamlLoads(null,
- """
+ expectYamlLoads(
+ null,
+ """
# Comment
""");
});
test('[Example 6.11]', () {
- expectYamlLoads({'key': 'value'},
- """
+ expectYamlLoads(
+ {'key': 'value'},
+ """
key: # Comment
# lines
value
@@ -918,8 +978,9 @@
group('ending a block scalar header', () {
test('may not be followed by additional comment lines', () {
- expectYamlLoads(["# not comment\nfoo\n"],
- """
+ expectYamlLoads(
+ ["# not comment\nfoo\n"],
+ """
- | # comment
# not comment
foo
@@ -930,20 +991,17 @@
group('6.7: Separation Lines', () {
test('may not be used within implicit keys', () {
- expectYamlFails(
- """
+ expectYamlFails("""
[1,
2]: 3""");
});
test('[Example 6.12]', () {
var doc = deepEqualsMap();
- doc[{'first': 'Sammy', 'last': 'Sosa'}] = {
- 'hr': 65,
- 'avg': 0.278
- };
- expectYamlLoads(doc,
- """
+ doc[{'first': 'Sammy', 'last': 'Sosa'}] = {'hr': 65, 'avg': 0.278};
+ expectYamlLoads(
+ doc,
+ """
{ first: Sammy, last: Sosa }:
# Statistics:
hr: # Home runs
@@ -956,8 +1014,9 @@
group('6.8: Directives', () {
// TODO(nweiz): assert that this produces a warning
test('[Example 6.13]', () {
- expectYamlLoads("foo",
- '''
+ expectYamlLoads(
+ "foo",
+ '''
%FOO bar baz # Should be ignored
# with a warning.
--- "foo"''');
@@ -965,8 +1024,9 @@
// TODO(nweiz): assert that this produces a warning.
test('[Example 6.14]', () {
- expectYamlLoads("foo",
- '''
+ expectYamlLoads(
+ "foo",
+ '''
%YAML 1.3 # Attempt parsing
# with a warning
---
@@ -974,24 +1034,23 @@
});
test('[Example 6.15]', () {
- expectYamlFails(
- """
+ expectYamlFails("""
%YAML 1.2
%YAML 1.1
foo""");
});
test('[Example 6.16]', () {
- expectYamlLoads("foo",
- '''
+ expectYamlLoads(
+ "foo",
+ '''
%TAG !yaml! tag:yaml.org,2002:
---
!yaml!str "foo"''');
});
test('[Example 6.17]', () {
- expectYamlFails(
- """
+ expectYamlFails("""
%TAG ! !foo
%TAG ! !foo
bar""");
@@ -1003,18 +1062,17 @@
group('6.9: Node Properties', () {
test('may be specified in any order', () {
- expectYamlLoads(["foo", "bar"],
- """
+ expectYamlLoads(
+ ["foo", "bar"],
+ """
- !!str &a1 foo
- &a2 !!str bar""");
});
test('[Example 6.23]', () {
- expectYamlLoads({
- "foo": "bar",
- "baz": "foo"
- },
- '''
+ expectYamlLoads(
+ {"foo": "bar", "baz": "foo"},
+ '''
!!str &a1 "foo":
!!str bar
&a2 baz : *a1''');
@@ -1032,8 +1090,9 @@
// currently doesn't plan to support.
test('[Example 6.28]', () {
- expectYamlLoads(["12", 12, "12"],
- '''
+ expectYamlLoads(
+ ["12", 12, "12"],
+ '''
# Assuming conventional resolution:
- "12"
- 12
@@ -1041,11 +1100,9 @@
});
test('[Example 6.29]', () {
- expectYamlLoads({
- "First occurrence": "Value",
- "Second occurrence": "Value"
- },
- """
+ expectYamlLoads(
+ {"First occurrence": "Value", "Second occurrence": "Value"},
+ """
First occurrence: &anchor Value
Second occurrence: *anchor""");
});
@@ -1054,8 +1111,7 @@
// Chapter 7: Flow Styles
group('7.1: Alias Nodes', () {
test("must not use an anchor that doesn't previously occur", () {
- expectYamlFails(
- """
+ expectYamlFails("""
- *anchor
- &anchor foo""");
});
@@ -1065,33 +1121,28 @@
});
group('must not specify', () {
- test('tag properties', () => expectYamlFails(
- """
+ test('tag properties', () => expectYamlFails("""
- &anchor foo
- !str *anchor"""));
- test('anchor properties', () => expectYamlFails(
- """
+ test('anchor properties', () => expectYamlFails("""
- &anchor foo
- &anchor2 *anchor"""));
- test('content', () => expectYamlFails(
- """
+ test('content', () => expectYamlFails("""
- &anchor foo
- *anchor bar"""));
});
test('must preserve structural equality', () {
- var doc = loadYaml(cleanUpLiteral(
- """
+ var doc = loadYaml(cleanUpLiteral("""
anchor: &anchor [a, b, c]
alias: *anchor"""));
var anchorList = doc['anchor'];
var aliasList = doc['alias'];
expect(anchorList, same(aliasList));
- doc = loadYaml(cleanUpLiteral(
- """
+ doc = loadYaml(cleanUpLiteral("""
? &anchor [a, b, c]
: ? *anchor
: bar"""));
@@ -1101,13 +1152,14 @@
});
test('[Example 7.1]', () {
- expectYamlLoads({
- "First occurrence": "Foo",
- "Second occurrence": "Foo",
- "Override anchor": "Bar",
- "Reuse anchor": "Bar",
- },
- """
+ expectYamlLoads(
+ {
+ "First occurrence": "Foo",
+ "Second occurrence": "Foo",
+ "Override anchor": "Bar",
+ "Reuse anchor": "Bar",
+ },
+ """
First occurrence: &anchor Foo
Second occurrence: *anchor
Override anchor: &anchor Bar
@@ -1117,11 +1169,9 @@
group('7.2: Empty Nodes', () {
test('[Example 7.2]', () {
- expectYamlLoads({
- "foo": "",
- "": "bar"
- },
- """
+ expectYamlLoads(
+ {"foo": "", "": "bar"},
+ """
{
foo : !!str,
!!str : bar,
@@ -1131,8 +1181,9 @@
test('[Example 7.3]', () {
var doc = deepEqualsMap({"foo": null});
doc[null] = "bar";
- expectYamlLoads(doc,
- """
+ expectYamlLoads(
+ doc,
+ """
{
? foo :,
: bar,
@@ -1142,10 +1193,13 @@
group('7.3: Flow Scalar Styles', () {
test('[Example 7.4]', () {
- expectYamlLoads({
- "implicit block key": [{"implicit flow key": "value"}]
- },
- '''
+ expectYamlLoads(
+ {
+ "implicit block key": [
+ {"implicit flow key": "value"}
+ ]
+ },
+ '''
"implicit block key" : [
"implicit flow key" : value,
]''');
@@ -1153,8 +1207,8 @@
test('[Example 7.5]', () {
expectYamlLoads(
- "folded to a space,\nto a line feed, or \t \tnon-content",
- '''
+ "folded to a space,\nto a line feed, or \t \tnon-content",
+ '''
"folded
to a space,\t
@@ -1163,8 +1217,9 @@
});
test('[Example 7.6]', () {
- expectYamlLoads(" 1st non-empty\n2nd non-empty 3rd non-empty ",
- '''
+ expectYamlLoads(
+ " 1st non-empty\n2nd non-empty 3rd non-empty ",
+ '''
" 1st non-empty
2nd non-empty
@@ -1176,18 +1231,22 @@
});
test('[Example 7.8]', () {
- expectYamlLoads({
- "implicit block key": [{"implicit flow key": "value"}]
- },
- """
+ expectYamlLoads(
+ {
+ "implicit block key": [
+ {"implicit flow key": "value"}
+ ]
+ },
+ """
'implicit block key' : [
'implicit flow key' : value,
]""");
});
test('[Example 7.9]', () {
- expectYamlLoads(" 1st non-empty\n2nd non-empty 3rd non-empty ",
- """
+ expectYamlLoads(
+ " 1st non-empty\n2nd non-empty 3rd non-empty ",
+ """
' 1st non-empty
2nd non-empty
@@ -1195,15 +1254,22 @@
});
test('[Example 7.10]', () {
- expectYamlLoads([
- "::vector", ": - ()", "Up, up, and away!", -123,
- "http://example.com/foo#bar",
- [
- "::vector", ": - ()", "Up, up, and away!", -123,
- "http://example.com/foo#bar"
- ]
- ],
- '''
+ expectYamlLoads(
+ [
+ "::vector",
+ ": - ()",
+ "Up, up, and away!",
+ -123,
+ "http://example.com/foo#bar",
+ [
+ "::vector",
+ ": - ()",
+ "Up, up, and away!",
+ -123,
+ "http://example.com/foo#bar"
+ ]
+ ],
+ '''
# Outside flow collection:
- ::vector
- ": - ()"
@@ -1219,18 +1285,22 @@
});
test('[Example 7.11]', () {
- expectYamlLoads({
- "implicit block key": [{"implicit flow key": "value"}]
- },
- """
+ expectYamlLoads(
+ {
+ "implicit block key": [
+ {"implicit flow key": "value"}
+ ]
+ },
+ """
implicit block key : [
implicit flow key : value,
]""");
});
test('[Example 7.12]', () {
- expectYamlLoads("1st non-empty\n2nd non-empty 3rd non-empty",
- """
+ expectYamlLoads(
+ "1st non-empty\n2nd non-empty 3rd non-empty",
+ """
1st non-empty
2nd non-empty
@@ -1240,21 +1310,26 @@
group('7.4: Flow Collection Styles', () {
test('[Example 7.13]', () {
- expectYamlLoads([
- ['one', 'two'],
- ['three', 'four']
- ],
- """
+ expectYamlLoads(
+ [
+ ['one', 'two'],
+ ['three', 'four']
+ ],
+ """
- [ one, two, ]
- [three ,four]""");
});
test('[Example 7.14]', () {
- expectYamlLoads([
- "double quoted", "single quoted", "plain text", ["nested"],
- {"single": "pair"}
- ],
- """
+ expectYamlLoads(
+ [
+ "double quoted",
+ "single quoted",
+ "plain text",
+ ["nested"],
+ {"single": "pair"}
+ ],
+ """
[
"double
quoted", 'single
@@ -1266,23 +1341,22 @@
});
test('[Example 7.15]', () {
- expectYamlLoads([
- {"one": "two", "three": "four"},
- {"five": "six", "seven": "eight"},
- ],
- """
+ expectYamlLoads(
+ [
+ {"one": "two", "three": "four"},
+ {"five": "six", "seven": "eight"},
+ ],
+ """
- { one : two , three: four , }
- {five: six,seven : eight}""");
});
test('[Example 7.16]', () {
- var doc = deepEqualsMap({
- "explicit": "entry",
- "implicit": "entry"
- });
+ var doc = deepEqualsMap({"explicit": "entry", "implicit": "entry"});
doc[null] = null;
- expectYamlLoads(doc,
- """
+ expectYamlLoads(
+ doc,
+ """
{
? explicit: entry,
implicit: entry,
@@ -1297,8 +1371,9 @@
"omitted value": null
});
doc[null] = "omitted key";
- expectYamlLoads(doc,
- '''
+ expectYamlLoads(
+ doc,
+ '''
{
unquoted : "separate",
http://foo.com,
@@ -1308,12 +1383,9 @@
});
test('[Example 7.18]', () {
- expectYamlLoads({
- "adjacent": "value",
- "readable": "value",
- "empty": null
- },
- '''
+ expectYamlLoads(
+ {"adjacent": "value", "readable": "value", "empty": null},
+ '''
{
"adjacent":value,
"readable": value,
@@ -1322,16 +1394,22 @@
});
test('[Example 7.19]', () {
- expectYamlLoads([{"foo": "bar"}],
- """
+ expectYamlLoads(
+ [
+ {"foo": "bar"}
+ ],
+ """
[
foo: bar
]""");
});
test('[Example 7.20]', () {
- expectYamlLoads([{"foo bar": "baz"}],
- """
+ expectYamlLoads(
+ [
+ {"foo bar": "baz"}
+ ],
+ """
[
? foo
bar : baz
@@ -1345,8 +1423,15 @@
var el2 = deepEqualsMap();
el2[{"JSON": "like"}] = "adjacent";
- expectYamlLoads([[{"YAML": "separate"}], [el1], [el2]],
- """
+ expectYamlLoads(
+ [
+ [
+ {"YAML": "separate"}
+ ],
+ [el1],
+ [el2]
+ ],
+ """
- [ YAML : separate ]
- [ : empty key entry ]
- [ {JSON: like}:adjacent ]""");
@@ -1368,8 +1453,15 @@
group('7.5: Flow Nodes', () {
test('[Example 7.23]', () {
- expectYamlLoads([["a", "b"], {"a": "b"}, "a", "b", "c"],
- """
+ expectYamlLoads(
+ [
+ ["a", "b"],
+ {"a": "b"},
+ "a",
+ "b",
+ "c"
+ ],
+ """
- [ a, b ]
- { a: b }
- "a"
@@ -1378,8 +1470,9 @@
});
test('[Example 7.24]', () {
- expectYamlLoads(["a", "b", "c", "c", ""],
- """
+ expectYamlLoads(
+ ["a", "b", "c", "c", ""],
+ """
- !!str "a"
- 'b'
- &anchor "c"
@@ -1391,8 +1484,9 @@
// Chapter 8: Block Styles
group('8.1: Block Scalar Styles', () {
test('[Example 8.1]', () {
- expectYamlLoads(["literal\n", " folded\n", "keep\n\n", " strip"],
- """
+ expectYamlLoads(
+ ["literal\n", " folded\n", "keep\n\n", " strip"],
+ """
- | # Empty header
literal
- >1 # Indentation indicator
@@ -1409,13 +1503,9 @@
// "\t detected\n", not "\t\ndetected\n". However, I'm reasonably
// confident that "\t\ndetected\n" is correct when parsed according to the
// rest of the spec.
- expectYamlLoads([
- "detected\n",
- "\n\n# detected\n",
- " explicit\n",
- "\t\ndetected\n"
- ],
- """
+ expectYamlLoads(
+ ["detected\n", "\n\n# detected\n", " explicit\n", "\t\ndetected\n"],
+ """
- |
detected
- >
@@ -1431,27 +1521,25 @@
});
test('[Example 8.3]', () {
- expectYamlFails(
- """
+ expectYamlFails("""
- |
text""");
- expectYamlFails(
- """
+ expectYamlFails("""
- >
text
text""");
- expectYamlFails(
- """
+ expectYamlFails("""
- |2
text""");
});
test('[Example 8.4]', () {
- expectYamlLoads({"strip": "text", "clip": "text\n", "keep": "text\n"},
- """
+ expectYamlLoads(
+ {"strip": "text", "clip": "text\n", "keep": "text\n"},
+ """
strip: |-
text
clip: |
@@ -1465,12 +1553,9 @@
// This example in the spec only includes a single newline in the "keep"
// value, but as far as I can tell that's not how it's supposed to be
// parsed according to the rest of the spec.
- expectYamlLoads({
- "strip": "# text",
- "clip": "# text\n",
- "keep": "# text\n\n"
- },
- """
+ expectYamlLoads(
+ {"strip": "# text", "clip": "# text\n", "keep": "# text\n\n"},
+ """
# Strip
# Comments:
strip: |-
@@ -1494,8 +1579,9 @@
});
test('[Example 8.6]', () {
- expectYamlLoads({"strip": "", "clip": "", "keep": "\n"},
- """
+ expectYamlLoads(
+ {"strip": "", "clip": "", "keep": "\n"},
+ """
strip: >-
clip: >
@@ -1506,8 +1592,9 @@
});
test('[Example 8.7]', () {
- expectYamlLoads("literal\n\ttext\n",
- """
+ expectYamlLoads(
+ "literal\n\ttext\n",
+ """
|
literal
\ttext
@@ -1515,8 +1602,9 @@
});
test('[Example 8.8]', () {
- expectYamlLoads("\n\nliteral\n \n\ntext\n",
- """
+ expectYamlLoads(
+ "\n\nliteral\n \n\ntext\n",
+ """
|
@@ -1529,8 +1617,9 @@
});
test('[Example 8.9]', () {
- expectYamlLoads("folded text\n",
- """
+ expectYamlLoads(
+ "folded text\n",
+ """
>
folded
text
@@ -1539,7 +1628,7 @@
test('[Example 8.10]', () {
expectYamlLoads(
- cleanUpLiteral("""
+ cleanUpLiteral("""
folded line
next line
@@ -1550,7 +1639,7 @@
last line
"""),
- """
+ """
>
folded
@@ -1574,18 +1663,28 @@
group('8.2: Block Collection Styles', () {
test('[Example 8.14]', () {
- expectYamlLoads({"block sequence": ["one", {"two": "three"}]},
- """
+ expectYamlLoads(
+ {
+ "block sequence": [
+ "one",
+ {"two": "three"}
+ ]
+ },
+ """
block sequence:
- one
- two : three""");
});
test('[Example 8.15]', () {
- expectYamlLoads([
- null, "block node\n", ["one", "two"], {"one": "two"}
- ],
- """
+ expectYamlLoads(
+ [
+ null,
+ "block node\n",
+ ["one", "two"],
+ {"one": "two"}
+ ],
+ """
- # Empty
- |
block node
@@ -1595,18 +1694,22 @@
});
test('[Example 8.16]', () {
- expectYamlLoads({"block mapping": {"key": "value"}},
- """
+ expectYamlLoads(
+ {
+ "block mapping": {"key": "value"}
+ },
+ """
block mapping:
key: value""");
});
test('[Example 8.17]', () {
- expectYamlLoads({
- "explicit key": null,
- "block key\n": ["one", "two"]
- },
- """
+ expectYamlLoads(
+ {
+ "explicit key": null,
+ "block key\n": ["one", "two"]
+ },
+ """
? explicit key # Empty value
? |
block key
@@ -1620,8 +1723,9 @@
"quoted key": ["entry"]
});
doc[null] = null;
- expectYamlLoads(doc,
- '''
+ expectYamlLoads(
+ doc,
+ '''
plain key: in-line value
: # Both empty
"quoted key":
@@ -1631,16 +1735,25 @@
test('[Example 8.19]', () {
var el = deepEqualsMap();
el[{'earth': 'blue'}] = {'moon': 'white'};
- expectYamlLoads([{'sun': 'yellow'}, el],
- """
+ expectYamlLoads(
+ [
+ {'sun': 'yellow'},
+ el
+ ],
+ """
- sun: yellow
- ? earth: blue
: moon: white""");
});
test('[Example 8.20]', () {
- expectYamlLoads(["flow in block", "Block scalar\n", {"foo": "bar"}],
- '''
+ expectYamlLoads(
+ [
+ "flow in block",
+ "Block scalar\n",
+ {"foo": "bar"}
+ ],
+ '''
-
"flow in block"
- >
@@ -1652,8 +1765,9 @@
test('[Example 8.21]', () {
// The spec doesn't include a newline after "value" in the parsed map, but
// the block scalar is clipped so it should be retained.
- expectYamlLoads({"literal": "value\n", "folded": "value"},
- """
+ expectYamlLoads(
+ {"literal": "value\n", "folded": "value"},
+ """
literal: |2
value
folded:
@@ -1663,11 +1777,15 @@
});
test('[Example 8.22]', () {
- expectYamlLoads({
- "sequence": ["entry", ["nested"]],
- "mapping": {"foo": "bar"}
- },
- """
+ expectYamlLoads(
+ {
+ "sequence": [
+ "entry",
+ ["nested"]
+ ],
+ "mapping": {"foo": "bar"}
+ },
+ """
sequence: !!seq
- entry
- !!seq
@@ -1683,8 +1801,9 @@
// doesn't plan to support.
test('[Example 9.2]', () {
- expectYamlLoads("Document",
- """
+ expectYamlLoads(
+ "Document",
+ """
%YAML 1.2
---
Document
@@ -1700,8 +1819,8 @@
// indented the same amount, the text would be part of the literal, which
// implies that the spec's parse of this document is incorrect.
expectYamlStreamLoads(
- ["Bare document", "%!PS-Adobe-2.0 # Not the first line\n"],
- """
+ ["Bare document", "%!PS-Adobe-2.0 # Not the first line\n"],
+ """
Bare
document
...
@@ -1713,8 +1832,12 @@
});
test('[Example 9.4]', () {
- expectYamlStreamLoads([{"matches %": 20}, null],
- """
+ expectYamlStreamLoads(
+ [
+ {"matches %": 20},
+ null
+ ],
+ """
---
{ matches
% : 20 }
@@ -1727,8 +1850,9 @@
test('[Example 9.5]', () {
// The spec doesn't have a space between the second
// "YAML" and "1.2", but this seems to be a typo.
- expectYamlStreamLoads(["%!PS-Adobe-2.0\n", null],
- """
+ expectYamlStreamLoads(
+ ["%!PS-Adobe-2.0\n", null],
+ """
%YAML 1.2
--- |
%!PS-Adobe-2.0
@@ -1740,8 +1864,13 @@
});
test('[Example 9.6]', () {
- expectYamlStreamLoads(["Document", null, {"matches %": 20}],
- """
+ expectYamlStreamLoads(
+ [
+ "Document",
+ null,
+ {"matches %": 20}
+ ],
+ """
Document
---
# Empty
@@ -1755,19 +1884,20 @@
// Chapter 10: Recommended Schemas
group('10.1: Failsafe Schema', () {
test('[Example 10.1]', () {
- expectYamlLoads({
- "Block style": {
- "Clark": "Evans",
- "Ingy": "döt Net",
- "Oren": "Ben-Kiki"
- },
- "Flow style": {
- "Clark": "Evans",
- "Ingy": "döt Net",
- "Oren": "Ben-Kiki"
- }
- },
- """
+ expectYamlLoads(
+ {
+ "Block style": {
+ "Clark": "Evans",
+ "Ingy": "döt Net",
+ "Oren": "Ben-Kiki"
+ },
+ "Flow style": {
+ "Clark": "Evans",
+ "Ingy": "döt Net",
+ "Oren": "Ben-Kiki"
+ }
+ },
+ """
Block style: !!map
Clark : Evans
Ingy : döt Net
@@ -1777,11 +1907,12 @@
});
test('[Example 10.2]', () {
- expectYamlLoads({
- "Block style": ["Clark Evans", "Ingy döt Net", "Oren Ben-Kiki"],
- "Flow style": ["Clark Evans", "Ingy döt Net", "Oren Ben-Kiki"]
- },
- """
+ expectYamlLoads(
+ {
+ "Block style": ["Clark Evans", "Ingy döt Net", "Oren Ben-Kiki"],
+ "Flow style": ["Clark Evans", "Ingy döt Net", "Oren Ben-Kiki"]
+ },
+ """
Block style: !!seq
- Clark Evans
- Ingy döt Net
@@ -1791,11 +1922,12 @@
});
test('[Example 10.3]', () {
- expectYamlLoads({
- "Block style": "String: just a theory.",
- "Flow style": "String: just a theory."
- },
- '''
+ expectYamlLoads(
+ {
+ "Block style": "String: just a theory.",
+ "Flow style": "String: just a theory."
+ },
+ '''
Block style: !!str |-
String: just a theory.
@@ -1872,16 +2004,17 @@
group('10.3: Core Schema', () {
test('[Example 10.9]', () {
- expectYamlLoads({
- "A null": null,
- "Also a null": null,
- "Not a null": "",
- "Booleans": [true, true, false, false],
- "Integers": [0, 7, 0x3A, -19],
- "Floats": [0, 0, 0.5, 12000, -200000],
- "Also floats": [infinity, -infinity, infinity, nan]
- },
- '''
+ expectYamlLoads(
+ {
+ "A null": null,
+ "Also a null": null,
+ "Not a null": "",
+ "Booleans": [true, true, false, false],
+ "Integers": [0, 7, 0x3A, -19],
+ "Floats": [0, 0, 0.5, 12000, -200000],
+ "Also floats": [infinity, -infinity, infinity, nan]
+ },
+ '''
A null: null
Also a null: # Empty
Not a null: ""