From 11ba56c83d470b545b894cc002453d8cce2e1d33 Mon Sep 17 00:00:00 2001 From: Junshu Okamoto Date: Thu, 29 Sep 2016 21:23:18 -0700 Subject: [PATCH] test: expand test coverage for url.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, line 156 of lib/url.js is not reachable from test-url because there is no example URL which has a white space in the front of the url. I added one example which can reach that line. PR-URL: https://github.com/nodejs/node/pull/8859 Reviewed-By: Michaƫl Zasso Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Ilkka Myller Reviewed-By: Franziska Hinkelmann --- test/parallel/test-url.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js index 3a6b53b8ee6e99..c1bd2a43d0e453 100644 --- a/test/parallel/test-url.js +++ b/test/parallel/test-url.js @@ -157,6 +157,17 @@ var parseTests = { path: '/Y' }, + // whitespace in the front + ' http://www.example.com/': { + href: 'http://www.example.com/', + protocol: 'http:', + slashes: true, + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + // + not an invalid host character // per https://url.spec.whatwg.org/#host-parsing 'http://x.y.com+a/b/c': {