public function ParserTest::getBlockChompingTests in Lockr 7.3
File
- vendor/
symfony/ yaml/ Tests/ ParserTest.php, line 137
Class
Namespace
Symfony\Component\Yaml\TestsCode
public function getBlockChompingTests() {
$tests = [];
$yaml = <<<'EOF'
foo: |-
one
two
bar: |-
one
two
EOF;
$expected = [
'foo' => "one\ntwo",
'bar' => "one\ntwo",
];
$tests['Literal block chomping strip with single trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |-
one
two
bar: |-
one
two
EOF;
$expected = [
'foo' => "one\ntwo",
'bar' => "one\ntwo",
];
$tests['Literal block chomping strip with multiple trailing newlines'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
{}
EOF;
$expected = [];
$tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |-
one
two
bar: |-
one
two
EOF;
$expected = [
'foo' => "one\ntwo",
'bar' => "one\ntwo",
];
$tests['Literal block chomping strip without trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |
one
two
bar: |
one
two
EOF;
$expected = [
'foo' => "one\ntwo\n",
'bar' => "one\ntwo\n",
];
$tests['Literal block chomping clip with single trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |
one
two
bar: |
one
two
EOF;
$expected = [
'foo' => "one\ntwo\n",
'bar' => "one\ntwo\n",
];
$tests['Literal block chomping clip with multiple trailing newlines'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo:
- bar: |
one
two
EOF;
$expected = [
'foo' => [
[
'bar' => "one\n\ntwo",
],
],
];
$tests['Literal block chomping clip with embedded blank line inside unindented collection'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |
one
two
bar: |
one
two
EOF;
$expected = [
'foo' => "one\ntwo\n",
'bar' => "one\ntwo",
];
$tests['Literal block chomping clip without trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |+
one
two
bar: |+
one
two
EOF;
$expected = [
'foo' => "one\ntwo\n",
'bar' => "one\ntwo\n",
];
$tests['Literal block chomping keep with single trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |+
one
two
bar: |+
one
two
EOF;
$expected = [
'foo' => "one\ntwo\n\n",
'bar' => "one\ntwo\n\n",
];
$tests['Literal block chomping keep with multiple trailing newlines'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: |+
one
two
bar: |+
one
two
EOF;
$expected = [
'foo' => "one\ntwo\n",
'bar' => "one\ntwo",
];
$tests['Literal block chomping keep without trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >-
one
two
bar: >-
one
two
EOF;
$expected = [
'foo' => 'one two',
'bar' => 'one two',
];
$tests['Folded block chomping strip with single trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >-
one
two
bar: >-
one
two
EOF;
$expected = [
'foo' => 'one two',
'bar' => 'one two',
];
$tests['Folded block chomping strip with multiple trailing newlines'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >-
one
two
bar: >-
one
two
EOF;
$expected = [
'foo' => 'one two',
'bar' => 'one two',
];
$tests['Folded block chomping strip without trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >
one
two
bar: >
one
two
EOF;
$expected = [
'foo' => "one two\n",
'bar' => "one two\n",
];
$tests['Folded block chomping clip with single trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >
one
two
bar: >
one
two
EOF;
$expected = [
'foo' => "one two\n",
'bar' => "one two\n",
];
$tests['Folded block chomping clip with multiple trailing newlines'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >
one
two
bar: >
one
two
EOF;
$expected = [
'foo' => "one two\n",
'bar' => 'one two',
];
$tests['Folded block chomping clip without trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >+
one
two
bar: >+
one
two
EOF;
$expected = [
'foo' => "one two\n",
'bar' => "one two\n",
];
$tests['Folded block chomping keep with single trailing newline'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >+
one
two
bar: >+
one
two
EOF;
$expected = [
'foo' => "one two\n\n",
'bar' => "one two\n\n",
];
$tests['Folded block chomping keep with multiple trailing newlines'] = [
$expected,
$yaml,
];
$yaml = <<<'EOF'
foo: >+
one
two
bar: >+
one
two
EOF;
$expected = [
'foo' => "one two\n",
'bar' => 'one two',
];
$tests['Folded block chomping keep without trailing newline'] = [
$expected,
$yaml,
];
return $tests;
}