Skip to content
Snippets Groups Projects
Commit ef3cbb66 authored by Praveen Arimbrathodiyil's avatar Praveen Arimbrathodiyil
Browse files

update description, add itp, enable tests

parent 032156a9
No related branches found
No related tags found
No related merge requests found
node-path-root-regex (0.1.2-1) UNRELEASED; urgency=low
node-path-root-regex (0.1.2-1) unstable; urgency=low
* Initial release (Closes: #nnnn)
* New upstream release
* Initial release (Closes: #846910)
-- Pirate Praveen <praveen@debian.org> Sun, 04 Dec 2016 13:56:50 +0530
-- Pirate Praveen <praveen@debian.org> Sun, 04 Dec 2016 15:21:35 +0530
......@@ -7,6 +7,7 @@ Build-Depends:
debhelper (>= 9)
, dh-buildinfo
, nodejs
, mocha
Standards-Version: 3.9.8
Homepage: https://github.com/regexhq/path-root-regex
Vcs-Git: https://anonscm.debian.org/git/pkg-javascript/node-path-root-regex.git
......@@ -17,7 +18,7 @@ Architecture: all
Depends:
${misc:Depends}
, nodejs
Description: Regular expression for getting the root of a posix or windows filepath.
FIX_ME long description
Description: regex for the root of a posix or windows filepath
Regular expression for getting the root of a posix or windows filepath.
.
Node.js is an event-based server-side JavaScript engine.
--- /dev/null
+++ b/test.js
@@ -0,0 +1,30 @@
+'use strict';
+
+require('mocha');
+var assert = require('assert');
+var regex = require('./');
+
+function match(str) {
+ var m = regex().exec(str);
+ return m ? m[0] : null;
+}
+
+describe('path-root-regex', function() {
+ it('should export a function', function() {
+ assert.equal(typeof regex, 'function');
+ });
+
+ it('should return a regex when called', function() {
+ assert(regex() instanceof RegExp);
+ });
+
+ it('should match the root of a filepath', function() {
+ assert.equal(match('\\\\server\\share\\abc'), '\\\\server\\share\\');
+ assert.equal(match('\\\\server foo\\some folder\\base-file.js'), '\\\\server foo\\some folder\\');
+ assert.equal(match('\\\\?\\UNC\\server\\share'), '\\\\?\\UNC\\');
+ assert.equal(match('foo/bar/baz.js'), '');
+ assert.equal(match('c:\\foo\\bar\\baz.js'), 'c:\\');
+ assert.equal(match('\\\\slslslsl\\admin$\\system32'), '\\\\slslslsl\\admin$\\');
+ assert.equal(match('/foo/bar/baz.js'), '/');
+ });
+});
add-tests.patch
......@@ -9,7 +9,5 @@
#override_dh_auto_build:
#override_dh_auto_test:
override_dh_auto_test:
mocha -R spec
Tests: require
Depends: node-path-root-regex
Test-Command: mocha -R spec
Depends: @, mocha
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment