diff -r 000000000000 -r 6474c204b198 browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,21 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that source URLs are abbreviated properly for display on the right- +// hand side of the Web Console. + +function test() { + testAbbreviation("http://example.com/x.js", "x.js"); + testAbbreviation("http://example.com/foo/bar/baz/boo.js", "boo.js"); + testAbbreviation("http://example.com/foo/bar/", "bar"); + testAbbreviation("http://example.com/foo.js?bar=1&baz=2", "foo.js"); + testAbbreviation("http://example.com/foo/?bar=1&baz=2", "foo"); + + finishTest(); +} + +function testAbbreviation(aFullURL, aAbbreviatedURL) { + is(WebConsoleUtils.abbreviateSourceURL(aFullURL), aAbbreviatedURL, aFullURL + + " is abbreviated to " + aAbbreviatedURL); +} +