aboutsummaryrefsl
aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2014-01-19 06:14:12 -0800
committerMihai Bazon <mihai.bazon@gmail.com>2014-01-19 06:14:12 -0800
commit2d8fc616773e30df955de02d99406f114b87490a (patch)
tree0c04c540b34283612557fa6103220166f4e3dda9 /lib/output.js
parent75cdbf19aaf03430d56da2ffe201f7403954d422 (diff)
parent1e31011874b82723c52589adfda3a451f7a9b0e7 (diff)
downloadtracifyjs-2d8fc616773e30df955de02d99406f114b87490a.tar.gz
tracifyjs-2d8fc616773e30df955de02d99406f114b87490a.zip
Merge pull request #402 from lautis/bom-regexps
Don't unescape byte order marks in regexps
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js
index 896defa3..fce2c1ad 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -1126,7 +1126,7 @@ function OutputStream(options) {
str = str.split("\\\\").map(function(str){
return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){
var code = parseInt(s.substr(2), 16);
- return code == 0x2f || code == 10 || code == 13 || code == 0x2028 || code == 0x2029 ? s : String.fromCharCode(code);
+ return code == 0xfeff || code == 0x2f || code == 10 || code == 13 || code == 0x2028 || code == 0x2029 ? s : String.fromCharCode(code);
});
}).join("\\\\");
}
;1.3.2\": { \"target\": \"e4a4be18fae8d9c6528abff3bc9088feb19a76c7\", \"target_type\": \"directory\", \"target_url\": \"/directory/e4a4be18fae8d9c6528abff3bc9088feb19a76c7\" }} }") (define snapshot-for-git "{ \"id\": 42, \"branches\": { \"1.3.2\": { \"target\": \"e4a4be18fae8d9c6528abff3bc9088feb19a76c7\", \"target_type\": \"revision\", \"target_url\": \"/revision/e4a4be18fae8d9c6528abff3bc9088feb19a76c7\" }} }") (define revision "{ \"author\": {}, \"committer\": {}, \"committer_date\": \"2018-05-17T21:43:49.422977+00:00\", \"date\": \"2018-05-17T21:43:49.422977+00:00\", \"directory\": \"d173c707ee88e3c89401ad77fafa65fcd9e9f5be\", \"directory_url\": \"/directory/d173c707ee88e3c89401ad77fafa65fcd9e9f5be\", \"id\": \"cd86c72084993d9ef26fc9e24b73cea612b8c97b\", \"merge\": false, \"message\": \"Fix.\", \"parents\": [], \"type\": \"what type?\" }") (with-http-server `((200 ,%origin) (200 ,visits) (200 ,snapshot-for-git-checkout) (200 ,snapshot-for-git) (200 ,revision)) (parameterize ((%swh-base-url (%local-url))) (let ((revision (lookup-origin-revision "https://example.org/repo.git" "1.3.2"))) (list (revision-id revision) (revision-directory revision))))))) (test-equal "lookup-directory-by-nar-hash" "swh:1:dir:84a8b34591712c0a90bab0af604188bcd1fe3153" (with-json-result %external-id (lookup-directory-by-nar-hash (nix-base32-string->bytevector "0qqygvlpz63phdi2p5p8ncp80dci230qfa3pwds8yfxqqaablmhb") 'sha256))) (test-equal "rate limit reached" 3000000000 (let ((too-many (build-response #:code 429 #:reason-phrase "Too many requests" ;; Pretend we've reached the limit and it'll be reset in ;; June 2065. #:headers '((x-ratelimit-remaining . "0") (x-ratelimit-reset . "3000000000"))))) (with-http-server `((,too-many "Too bad.")) (parameterize ((%swh-base-url (%local-url))) (catch 'swh-error (lambda () (lookup-origin "http://example.org/guix.git")) (lambda (key url method response) ;; Ensure the reset time was recorded. (@@ (guix swh) %general-rate-limit-reset-time))))))) (test-assert "%allow-request? and request-rate-limit-reached?" ;; Here we test two things: that the rate limit set above is in effect and ;; that %ALLOW-REQUEST? is called, and that 'request-rate-limit-reached?' ;; returns true. (let* ((key (gensym "skip-request")) (skip-if-limit-reached (lambda (url method) (or (not (request-rate-limit-reached? url method)) (throw key #t))))) (parameterize ((%allow-request? skip-if-limit-reached)) (catch key (lambda () (lookup-origin "http://example.org/guix.git") #f) (const #t))))) (test-end "swh") ;; Local Variables: ;; eval: (put 'with-json-result 'scheme-indent-function 1) ;; eval: (put 'with-http-server 'scheme-indent-function 1) ;; End: