Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.137.167.53
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/task/2/root/proc/2/cwd/usr/lib/node_modules/npm/node_modules/jsonparse/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/task/2/root/proc/2/cwd/usr/lib/node_modules/npm/node_modules/jsonparse/test/offset.js
var test = require('tape');
var Parser = require('../');

var input = '{\n  "string": "value",\n  "number": 3,\n  "object"';
var input2 = ': {\n  "key": "vд"\n  },\n  "array": [\n  -1,\n  12\n  ]\n  ';
var input3 = '"null": null, "true": true, "false": false, "frac": 3.14 }';

var offsets = [
  [ 0, Parser.C.LEFT_BRACE ],
  [ 4, Parser.C.STRING ],
  [ 12, Parser.C.COLON ],
  [ 14, Parser.C.STRING ],
  [ 21, Parser.C.COMMA ],
  [ 25, Parser.C.STRING ],
  [ 33, Parser.C.COLON ],
  [ 35, Parser.C.NUMBER ],
  [ 36, Parser.C.COMMA ],
  [ 40, Parser.C.STRING ],
  [ 48, Parser.C.COLON ],
  [ 50, Parser.C.LEFT_BRACE ],
  [ 54, Parser.C.STRING ],
  [ 59, Parser.C.COLON ],
  [ 61, Parser.C.STRING ],
  [ 69, Parser.C.RIGHT_BRACE ],
  [ 70, Parser.C.COMMA ],
  [ 74, Parser.C.STRING ],
  [ 81, Parser.C.COLON ],
  [ 83, Parser.C.LEFT_BRACKET ],
  [ 87, Parser.C.NUMBER ],
  [ 89, Parser.C.COMMA ],
  [ 93, Parser.C.NUMBER ],
  [ 98, Parser.C.RIGHT_BRACKET ],
  [ 102, Parser.C.STRING ],
  [ 108, Parser.C.COLON ],
  [ 110, Parser.C.NULL ],
  [ 114, Parser.C.COMMA ],
  [ 116, Parser.C.STRING ],
  [ 122, Parser.C.COLON ],
  [ 124, Parser.C.TRUE ],
  [ 128, Parser.C.COMMA ],
  [ 130, Parser.C.STRING ],
  [ 137, Parser.C.COLON ],
  [ 139, Parser.C.FALSE ],
  [ 144, Parser.C.COMMA ],
  [ 146, Parser.C.STRING ],
  [ 152, Parser.C.COLON ],
  [ 154, Parser.C.NUMBER ],
  [ 159, Parser.C.RIGHT_BRACE ]
];

test('offset', function(t) {
  t.plan(offsets.length * 2 + 1);

  var p = new Parser();
  var i = 0;
  p.onToken = function (token) {
    t.equal(p.offset, offsets[i][0]);
    t.equal(token, offsets[i][1]);
    i++;
  };

  p.write(input);
  p.write(input2);
  p.write(input3);

  t.equal(i, offsets.length);
});

Anon7 - 2022
AnonSec Team