summaryrefslogtreecommitdiff
path: root/test/parallel/test-console-table.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-08-25 01:39:54 +0200
committerAnto Aravinth <anto.aravinth.cse@gmail.com>2019-09-02 11:43:58 +0530
commit9e23eeffd009dbec3a6d2fc78c8e7e53576ad4f9 (patch)
tree3b18fc4c7e16d0f4efcc87e24835e427eb0a1808 /test/parallel/test-console-table.js
parent2cc757f0c703598c1bc5777e79c9344c946df2cc (diff)
downloadandroid-node-v8-9e23eeffd009dbec3a6d2fc78c8e7e53576ad4f9.tar.gz
android-node-v8-9e23eeffd009dbec3a6d2fc78c8e7e53576ad4f9.tar.bz2
android-node-v8-9e23eeffd009dbec3a6d2fc78c8e7e53576ad4f9.zip
console: use getStringWidth() for character width calculation
This is more accurate for displayed full-width characters (e.g. CJK ones) and makes the calculations match the ones we use in the readline module. Fixes: https://github.com/nodejs/node/issues/29299 PR-URL: https://github.com/nodejs/node/pull/29300 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-console-table.js')
-rw-r--r--test/parallel/test-console-table.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/parallel/test-console-table.js b/test/parallel/test-console-table.js
index eba7ba610c..706cd20ad1 100644
--- a/test/parallel/test-console-table.js
+++ b/test/parallel/test-console-table.js
@@ -258,3 +258,21 @@ test([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], `
└─────────┴──${line}──┘
`);
}
+
+test({ foo: '¥', bar: '¥' }, `
+┌─────────┬────────┐
+│ (index) │ Values │
+├─────────┼────────┤
+│ foo │ '¥' │
+│ bar │ '¥' │
+└─────────┴────────┘
+`);
+
+test({ foo: '你好', bar: 'hello' }, `
+┌─────────┬─────────┐
+│ (index) │ Values │
+├─────────┼─────────┤
+│ foo │ '你好' │
+│ bar │ 'hello' │
+└─────────┴─────────┘
+`);