8000 [Yaml] Implement $blockChompingIndicator for TaggedValue multi-line literal blocks by natepage · Pull Request #40431 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Yaml] Implement $blockChompingIndicator for TaggedValue multi-line literal blocks #40431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 7.4
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clean up test for duplicates
  • Loading branch information
natepage committed May 3, 2021
8000 commit 7abeafca0540e7fbfa34f51d50d72d451efc9092
32 changes: 4 additions & 28 deletions src/Symfony/Component/Yaml/Tests/DumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,34 +599,22 @@ public function testDumpTrailingNewlineInMultiLineLiteralBlocksForTaggedValues()
{
$data = [
'clip 1' => new TaggedValue('my-tag', "one\ntwo\n"),
'clip 2' => new TaggedValue('my-tag', "one\ntwo\n"),
'keep 1' => new TaggedValue('my-tag', "one\ntwo\n"),
'keep 2' => new TaggedValue('my-tag', "one\ntwo\n\n"),
'keep 1' => new TaggedValue('my-tag', "one\ntwo\n\n"),
'strip 1' => new TaggedValue('my-tag', "one\ntwo"),
'strip 2' => new TaggedValue('my-tag', "one\ntwo"),
];
$yaml = $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);

$expected = <<<YAML
'clip 1': !my-tag |
one
two
'clip 2': !my-tag |
one
two
'keep 1': !my-tag |
one
two
'keep 2': !my-tag |+
'keep 1': !my-tag |+
one
two

'strip 1': !my-tag |-
one
two
'strip 2': !my-tag |-
one
two
YAML;

$this->assertSame($expected, $yaml);
Expand All @@ -636,34 +624,22 @@ public function testDumpTrailingNewlineInMultiLineLiteralBlocks()
{
$data = [
'clip 1' => "one\ntwo\n",
'clip 2' => "one\ntwo\n",
'keep 1' => "one\ntwo\n",
'keep 2' => "one\ntwo\n\n",
'keep 1' => "one\ntwo\n\n",
'strip 1' => "one\ntwo",
'strip 2' => "one\ntwo",
];
$yaml = $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);

$expected = <<<YAML
'clip 1': |
one
two
'clip 2': |
one
two
'keep 1': |
one
two
'keep 2': |+
'keep 1': |+
one
two

'strip 1': |-
one
two
'strip 2': |-
one
two
YAML;

$this->assertSame($expected, $yaml);
Expand Down
0