Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/jsonparse/test/ |
Upload File : |
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); });