This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "Missing arguments." | |
exit 1 | |
fi | |
numOfDir=0 #count how many are directories | |
for entry in "$@" # loop through arugments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!isWindows) { | |
test('absolute path', function () { | |
const path = '/foo/bar'; | |
assert.equal(URI.file(path).path, path); | |
}); | |
test('relative path', function () { | |
const path = 'foo/bar'; | |
assert.equal(URI.file(path).path, path); | |
const fileUri1 = URI.parse(`file:foo/bar`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('prepareSearchForScoring', function () { | |
assert.equal(scorer.prepareQuery(' f*a ').value, 'fa'); | |
assert.equal(scorer.prepareQuery('model Tester.ts').value, 'model Tester.ts'); | |
assert.equal(scorer.prepareQuery('Model Tester.ts').lowercase, 'model tester.ts'); | |
assert.equal(scorer.prepareQuery('ModelTester.ts').containsPathSeparator, false); | |
assert.equal(scorer.prepareQuery('Model' + nativeSep + 'Tester.ts').containsPathSeparator, true); | |
assert.equal(scorer.prepareQuery('dir' + nativeSep + 'tester.ts').value, 'dir' + nativeSep + 'tester.ts'); | |
assert.equal(scorer.prepareQuery('dir' + nativeSep + 'model tester.ts').value, 'dir' + nativeSep + 'model tester.ts'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hack to deal with about:* pages | |
const fixDisplayURL = (navigationEntry, controller) => { | |
if (navigationEntry == null) { | |
return null | |
} | |
navigationEntry = Object.assign({}, navigationEntry) | |
//console.log("fixDisplayURL-->IN-->", navigationEntry.virtualURL) | |
navigationEntry.virtualURL = getLocationIfPDF(navigationEntry.virtualURL) | |
//console.log("fixDisplayURL-->OUT-->", navigationEntry.virtualURL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (case2Reg.test(str) || !case3Reg.test(str) || | |
(scheme === undefined && /\s/g.test(str))) { | |
if (scheme === undefined && /\s/g.test(str)) { | |
// check to see if undefined scheme is possibly file scheme | |
let str1 = UrlUtil.prependScheme(str) | |
if (UrlUtil.isFileScheme(str1)) { | |
// if it is file scheme, will then replace whitespace with %20 | |
str = str.replace(' ', '%20') | |
} else { | |
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (/\s/g.test(str) && scheme !== undefined) { | |
// attempt to change query whitespace to %20 | |
var queryIndex = str.search(/\?.*$/) | |
if (queryIndex > 0) { | |
var query = str.substring(queryIndex).replace(/\s/g, '%20') | |
str = str.substring(0, queryIndex) + query | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('isNotURL', function () { | |
describe('returns false when input:', function () { | |
it('is a valid URL', function () { | |
assert.equal(urlUtil.isNotURL('brave.com'), false) | |
}) | |
it('is an absolute file path without scheme', function () { | |
assert.equal(urlUtil.isNotURL('/file/path/to/file'), false) | |
}) | |
it('is an absolute file path with scheme', function () { | |
assert.equal(urlUtil.isNotURL('file:///file/path/to/file'), false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('getUrlFromInput', function () { | |
it('returns empty string when input is null', function () { | |
assert.equal(urlUtil.getUrlFromInput(null), '') | |
}) | |
it('returns empty string when input is undefined', function () { | |
assert.equal(urlUtil.getUrlFromInput(), '') | |
}) | |
it('calls prependScheme', function () { | |
assert.equal(urlUtil.getUrlFromInput('/file/path/to/file'), 'file:///file/path/to/file') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2018 Owen Mak. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
info: | | |
The elements of the array are rearranged so as to reverse their order. | |
The object is returned as the result of the call | |
esid: sec-array.prototype.reverse | |
es6id: 22.1.3.20_A1_T2 | |
description: Checking this algorithm, elements are objects and primitives | |
... |