Skip to content

Instantly share code, notes, and snippets.

@seaneagan
Created December 10, 2014 22:00
Show Gist options
  • Save seaneagan/3697f6c6371ac57d1cf8 to your computer and use it in GitHub Desktop.
Save seaneagan/3697f6c6371ac57d1cf8 to your computer and use it in GitHub Desktop.
yaml_map_value_node_end_offset_test.dart
import 'package:yaml/yaml.dart';
main() {
var node = loadYamlNode(yaml);
var actualFooEnd = node.nodes['c'].nodes['x'].span.end.offset;
var expectedFooEnd = yaml.indexOf('foo') + 'foo'.length;
print('actual foo end: $actualFooEnd');
print('expected foo end: $expectedFooEnd');
assert(actualFooEnd == expectedFooEnd);
}
var yaml = '''
a: 1
b: 2
c:
x: foo
y: bar
z: baz
d: 3
''';
@seaneagan
Copy link
Author

It reports the end index of the "foo" node to be the start index of the "y" node, which is incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment