CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
test-path.js108 linesDownload Raw Back to test
1// Copyright Joyent, Inc. and other Node contributors.2//3// Permission is hereby granted, free of charge, to any person obtaining a4// copy of this software and associated documentation files (the5// "Software"), to deal in the Software without restriction, including6// without limitation the rights to use, copy, modify, merge, publish,7// distribute, sublicense, and/or sell copies of the Software, and to permit8// persons to whom the Software is furnished to do so, subject to the9// following conditions:10//11// The above copyright notice and this permission notice shall be included12// in all copies or substantial portions of the Software.13//14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS15// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN17// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,18// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20// USE OR OTHER DEALINGS IN THE SOFTWARE.21 22'use strict';23var tape = require('tape');24var path = require('../');25 26// Test thrown TypeErrors27var typeErrorTests = [true, false, 7, null, {}, undefined, [], NaN];28 29function fail(t, fn) {30  var args = [].slice.call(arguments, 1);31 32  t.throws(function () {33    fn.apply(null, args);34  }, TypeError);35}36 37tape('path.posix TypeErrors', function (t) {38  typeErrorTests.forEach(function (test) {39    fail(t, path.posix.join, test);40    fail(t, path.posix.resolve, test);41    fail(t, path.posix.normalize, test);42    fail(t, path.posix.isAbsolute, test);43    fail(t, path.posix.relative, test, 'foo');44    fail(t, path.posix.relative, 'foo', test);45    fail(t, path.posix.parse, test);46    fail(t, path.posix.dirname, test);47    fail(t, path.posix.basename, test);48    fail(t, path.posix.extname, test);49 50    // undefined is a valid value as the second argument to basename51    if (test !== undefined) {52      fail(t, path.posix.basename, 'foo', test);53    }54  });55  t.end();56});57 58tape('path.win32 TypeErrors', { skip: true }, function (t) {59  typeErrorTests.forEach(function (test) {60    fail(t, path.win32.join, test);61    fail(t, path.win32.resolve, test);62    fail(t, path.win32.normalize, test);63    fail(t, path.win32.isAbsolute, test);64    fail(t, path.win32.relative, test, 'foo');65    fail(t, path.win32.relative, 'foo', test);66    fail(t, path.win32.parse, test);67    fail(t, path.win32.dirname, test);68    fail(t, path.win32.basename, test);69    fail(t, path.win32.extname, test);70 71    // undefined is a valid value as the second argument to basename72    if (test !== undefined) {73      fail(t, path.win32.basename, 'foo', test);74    }75  });76  t.end();77});78 79// path.sep tests80tape('path.win32.sep', { skip: true }, function (t) {81  // windows82  t.strictEqual(path.win32.sep, '\\');83  t.end();84});85tape('path.posix.sep', function (t) {86  // posix87  t.strictEqual(path.posix.sep, '/');88  t.end();89});90 91// path.delimiter tests92tape('path.win32.delimiter', { skip: true }, function (t) {93  // windows94  t.strictEqual(path.win32.delimiter, ';');95  t.end();96});97tape('path.posix.delimiter', function (t) {98  // posix99  t.strictEqual(path.posix.delimiter, ':');100  t.end();101});102 103tape('path', function (t) {104  t.strictEqual(path, path.posix);105  t.end();106});107 108 
basant307/AI_Governance_Project · CoolFace