From 0291d45fce59327890ecc687507162e3970dacf8 Mon Sep 17 00:00:00 2001 From: Damien Debin Date: Thu, 21 Nov 2024 15:31:38 +0100 Subject: [PATCH] fix: test unlimited `--lineWidth` --- test/test-long-line.yml | 5 +++++ test/test.js | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/test-long-line.yml diff --git a/test/test-long-line.yml b/test/test-long-line.yml new file mode 100644 index 0000000..ae6e662 --- /dev/null +++ b/test/test-long-line.yml @@ -0,0 +1,5 @@ +b: + c: + d: false + b: 35 +a: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nec volutpat mi, ac consectetur est. Proin venenatis tortor ut erat interdum finibus. \ No newline at end of file diff --git a/test/test.js b/test/test.js index 14d334e..8ec92c3 100755 --- a/test/test.js +++ b/test/test.js @@ -137,6 +137,19 @@ test('CLI --lineWidth', (t) => { proc.end() }) +test('CLI --lineWidth unlimited', (t) => { + const proc = spawn(t, '../yaml-sort.js --input test-long-line.yml --stdout --lineWidth -1', opts) + proc.exitCode(0) + proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nec volutpat mi, ac consectetur est. Proin venenatis tortor ut erat interdum finibus.\n' + + 'b:\n' + + ' b: 35\n' + + ' c:\n' + + ' d: false\n' + + '\n') + proc.stderr.match('') + proc.end() +}) + test('CLI --check FAIL', (t) => { const proc = spawn(t, '../yaml-sort.js --input test.yml --check', opts)