Merge branch 'master' into research-merge; broken

This commit is contained in:
Curtis Yarvin 2018-05-03 10:51:39 -07:00
commit 07fd6faab9
52 changed files with 3483 additions and 1086 deletions

2
.travis/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Don't show in diffs or auto-merge
package-lock.json binary

View File

@ -1,79 +1,58 @@
#!/bin/bash
set -euo pipefail
# set -x
set -x
# XX use -s instead of hash pill
HASH=$(git -C .. log -1 HEAD --format=%H -- sys/)
export PILL_NAME="git-${HASH:0:10}"
if [ ! ${PILL_FORCE:-} ]; then
: Trying pill for commit
wget https://bootstrap.urbit.org/$PILL_NAME.pill -O urbit.pill && exit 0
fi
# if wget failed
if [ ${TRAVIS_COMMIT:-} ] && [ $TRAVIS_COMMIT != $HASH ]; then
echo Directory sys/ not modified in commit $TRAVIS_COMMIT
echo FIXME ignoring, as current sys/ commits are unlikely to contain the pill-build code
echo
# echo For auto-build please tag and push $HASH
: Directory sys/ not modified in commit $TRAVIS_COMMIT
: FIXME ignoring, as current sys/ commits are unlikely to contain the pill-build code
:
# : For auto-build please tag and push $HASH
# exit 1
fi
mkdir prev
{
echo Pilling: trying pinned fakezod
: Pilling: trying pinned fakezod
wget -i pin-parent-pill-pier.url -O - | tar xvz -C prev/ &&
echo Downloaded prev/zod
: Downloaded prev/zod &&
lsc ./in-urbit.ls -FI zod prev/zod <<' .'
|autoload |
|mount %
.
[ $? = 0 ] && cp -r ../sys prev/zod/home/
} || {
echo Pilling: Parent-pill pier not available, trying preceding pill commit
: Pilling: Parent-pill pier not available, trying preceding pill commit
HASH2=$(git -C .. log -2 $HASH --format=%H -- sys/ | tail -1)
PILL_NAME2="git-${HASH2:0:10}"
wget https://bootstrap.urbit.org/$PILL_NAME2.pill -O urbit.pill &&
echo FIXME running test script to create fakezod, this might be overkill &&
lsc test.ls &&
mv urbit.pill prev/urbit.pill &&
mv zod prev/zod &&
export PIER_FRESH="y"
wget https://bootstrap.urbit.org/$PILL_NAME2.pill -O prev/urbit.pill &&
lsc ./in-urbit.ls -A .. -B prev/urbit.pill -cFI zod prev/zod <<' .'
%booted-prev-zod
.
} || {
echo Pilling: Out of ideas
: Pilling: Out of ideas
exit 1
}
lsc <<done
do
require! <[ stream-snitch once recursive-copy wait-on ]>
pty = require \pty.js
urbit = pty.spawn 'urbit' <[-FI zod prev/zod]>
.on \data -> process.stdout.write it
: Pier created, soliding actual pill
lsc ./in-urbit.ls -FI zod prev/zod <<.
|label %home %$PILL_NAME
.urbit/pill +solid /==/$PILL_NAME/sys, =dub &
.
on-next = (re,cb)->
urbit.pipe (new stream-snitch re).on \match once cb
on-next /\n(\/~|ford: )/ ->
console.log "\n\n---\nnode: detected error\n---\n\n"
set-timeout (-> process.exit 1), 1000
<- on-next /dojo> /
{PILL_NAME} = process.env
do-pill = ->
urbit.write "|label %home %#PILL_NAME\r"
urbit.write ".urbit/pill +solid /==/#PILL_NAME/sys, =dub &\r"
<- wait-on resources: <[ prev/zod/.urb/put/urbit.pill ]>
urbit.write "\04"
process.exit 0
#
if process.env.PIER_FRESH then do-pill!
urbit.write "|autoload |\r"
urbit.write "|mount %\r"
<- wait-on resources: <[ prev/zod/home ]>
<- recursive-copy '../sys/' 'prev/zod/home/sys/' {+overwrite} .then
on-next /sync/ do-pill
done
cp prev/zod/.urb/put/urbit.pill urbit.pill
mkdir built-pill; cp urbit.pill built-pill/$PILL_NAME.pill
echo
echo Created $PILL_NAME.pill, to be uploaded if tests pass
echo
:
: Created $PILL_NAME.pill, to be uploaded if tests pass
:

15
.travis/in-urbit.ls Normal file
View File

@ -0,0 +1,15 @@
require! <[ split ]>
{through} = require 'promise-streams'
{Urbit,ERROR} = require './runner.ls'
urbit = new Urbit process.argv[2 to]
urbit.expect ERROR .then -> process.exit 1
<- urbit.expect /dojo> / .then
process.stdin.pipe split!
.pipe through ->
urbit.line it.trim!replace /\$[a-zA-Z0-9_]+/g ->
process.env[it.slice 1] ? '__unknown-var__'
.wait!then -> urbit.exit 0

851
.travis/package-lock.json generated Normal file
View File

@ -0,0 +1,851 @@
{
"name": "arvo-tests",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bluebird": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
"integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE="
},
"colors": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz",
"integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM="
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"livescript": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/livescript/-/livescript-1.5.0.tgz",
"integrity": "sha1-T+cSHEEhfkYI4zTrnL4XYuY+VWY=",
"requires": {
"optionator": "0.8.2",
"prelude-ls": "1.1.2",
"source-map": "0.5.7"
},
"dependencies": {
"deep-is": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ="
},
"fast-levenshtein": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
},
"levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
"integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
"requires": {
"prelude-ls": "1.1.2",
"type-check": "0.3.2"
}
},
"optionator": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
"integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
"requires": {
"deep-is": "0.1.3",
"fast-levenshtein": "2.0.6",
"levn": "0.3.0",
"prelude-ls": "1.1.2",
"type-check": "0.3.2",
"wordwrap": "1.0.0"
}
},
"prelude-ls": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
},
"type-check": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
"integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
"requires": {
"prelude-ls": "1.1.2"
}
},
"wordwrap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
}
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
}
},
"promise-streams": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/promise-streams/-/promise-streams-2.1.1.tgz",
"integrity": "sha1-cwnx02mDMOp/rasZIvE5iSKayFo=",
"requires": {
"bluebird": "2.11.0"
}
},
"pty.js": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/pty.js/-/pty.js-0.3.1.tgz",
"integrity": "sha1-gfW+0zLW5eeraFaI0boDc0ENUbU=",
"requires": {
"extend": "1.2.1",
"nan": "2.3.5"
},
"dependencies": {
"extend": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz",
"integrity": "sha1-oPX9bPyDpf5J72mNYOyKYk3UV2w="
},
"nan": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.3.5.tgz",
"integrity": "sha1-gioNwmYpDOTNOhIoLKPn42Rmigg="
}
}
},
"recursive-copy": {
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/recursive-copy/-/recursive-copy-2.0.9.tgz",
"integrity": "sha512-0AkHV+QtfS/1jW01z3m2t/TRTW56Fpc+xYbsoa/bqn8BCYPwmsaNjlYmUU/dyGg9w8MmGoUWihU5W+s+qjxvBQ==",
"requires": {
"del": "2.2.2",
"emitter-mixin": "0.0.3",
"errno": "0.1.7",
"graceful-fs": "4.1.11",
"junk": "1.0.3",
"maximatch": "0.1.0",
"mkdirp": "0.5.1",
"pify": "2.3.0",
"promise": "7.3.1",
"slash": "1.0.0"
},
"dependencies": {
"array-differ": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE="
},
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
"requires": {
"array-uniq": "1.0.3"
}
},
"array-uniq": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
"integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY="
},
"arrify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
},
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "1.0.0",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"del": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
"integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",
"requires": {
"globby": "5.0.0",
"is-path-cwd": "1.0.0",
"is-path-in-cwd": "1.0.0",
"object-assign": "4.1.1",
"pify": "2.3.0",
"pinkie-promise": "2.0.1",
"rimraf": "2.6.2"
}
},
"emitter-mixin": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/emitter-mixin/-/emitter-mixin-0.0.3.tgz",
"integrity": "sha1-WUjLKG8uSO3DslGnz8H3iDOW1lw="
},
"errno": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
"requires": {
"prr": "1.0.1"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"globby": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
"integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
"requires": {
"array-union": "1.0.2",
"arrify": "1.0.1",
"glob": "7.1.2",
"object-assign": "4.1.1",
"pify": "2.3.0",
"pinkie-promise": "2.0.1"
}
},
"graceful-fs": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"is-path-cwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
"integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0="
},
"is-path-in-cwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz",
"integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=",
"requires": {
"is-path-inside": "1.0.1"
}
},
"is-path-inside": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
"integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=",
"requires": {
"path-is-inside": "1.0.2"
}
},
"junk": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/junk/-/junk-1.0.3.tgz",
"integrity": "sha1-h75jSIZJy9ym9Tqzm+yczSNH9ZI="
},
"maximatch": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz",
"integrity": "sha1-hs2NawTJ8wfAWmuUGZBtA2D7E6I=",
"requires": {
"array-differ": "1.0.0",
"array-union": "1.0.2",
"arrify": "1.0.1",
"minimatch": "3.0.4"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"requires": {
"brace-expansion": "1.1.11"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-is-inside": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM="
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
},
"pinkie-promise": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"requires": {
"pinkie": "2.0.4"
}
},
"promise": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
"integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
"requires": {
"asap": "2.0.6"
}
},
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY="
},
"rimraf": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
"requires": {
"glob": "7.1.2"
}
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU="
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}
}
},
"split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"requires": {
"through": "2.3.8"
}
},
"stream-snitch": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/stream-snitch/-/stream-snitch-0.0.3.tgz",
"integrity": "sha1-iXp48TonFPqESqd74VR3qJbYUqk="
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"wait-on": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-2.1.0.tgz",
"integrity": "sha512-hDwJ674+7dfiiK/cxtYCwPxlnjXDjto/pCz1PF02sXUhqCqCWsgvxZln0699PReWqXXgkxqkF6DDo5Rj9sjNvw==",
"requires": {
"core-js": "2.5.3",
"joi": "9.2.0",
"minimist": "1.2.0",
"request": "2.83.0",
"rx": "4.1.0"
},
"dependencies": {
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "4.6.0",
"fast-deep-equal": "1.1.0",
"fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.3.1"
}
},
"asn1": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y="
},
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
},
"aws4": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz",
"integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4="
},
"bcrypt-pbkdf": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
"optional": true,
"requires": {
"tweetnacl": "0.14.5"
}
},
"boom": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
"integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
"requires": {
"hoek": "4.2.1"
}
},
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
},
"combined-stream": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
"requires": {
"delayed-stream": "1.0.0"
}
},
"core-js": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz",
"integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"cryptiles": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",
"integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
"requires": {
"boom": "5.2.0"
},
"dependencies": {
"boom": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",
"integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==",
"requires": {
"hoek": "4.2.1"
}
}
}
},
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"requires": {
"assert-plus": "1.0.0"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"ecc-jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
"optional": true,
"requires": {
"jsbn": "0.1.1"
}
},
"extend": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
},
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
"form-data": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
"requires": {
"asynckit": "0.4.0",
"combined-stream": "1.0.6",
"mime-types": "2.1.18"
}
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"requires": {
"assert-plus": "1.0.0"
}
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
},
"har-validator": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"requires": {
"ajv": "5.5.2",
"har-schema": "2.0.0"
}
},
"hawk": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",
"integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==",
"requires": {
"boom": "4.3.1",
"cryptiles": "3.1.2",
"hoek": "4.2.1",
"sntp": "2.1.0"
}
},
"hoek": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"requires": {
"assert-plus": "1.0.0",
"jsprim": "1.4.1",
"sshpk": "1.13.1"
}
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isemail": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz",
"integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY="
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"items": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/items/-/items-2.1.1.tgz",
"integrity": "sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg="
},
"joi": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz",
"integrity": "sha1-M4WseQGSEwy+Iw6ALsAskhW7/to=",
"requires": {
"hoek": "4.2.1",
"isemail": "2.2.1",
"items": "2.1.1",
"moment": "2.21.0",
"topo": "2.0.2"
}
},
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
"optional": true
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"verror": "1.10.0"
}
},
"mime-db": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
"integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
},
"mime-types": {
"version": "2.1.18",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
"integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
"requires": {
"mime-db": "1.33.0"
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
"moment": {
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.21.0.tgz",
"integrity": "sha512-TCZ36BjURTeFTM/CwRcViQlfkMvL1/vFISuNLO5GkcVm1+QHfbSiNqZuWeMFjj1/3+uAjXswgRk30j1kkLYJBQ=="
},
"oauth-sign": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
"integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM="
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"punycode": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
},
"qs": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
},
"request": {
"version": "2.83.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz",
"integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==",
"requires": {
"aws-sign2": "0.7.0",
"aws4": "1.6.0",
"caseless": "0.12.0",
"combined-stream": "1.0.6",
"extend": "3.0.1",
"forever-agent": "0.6.1",
"form-data": "2.3.2",
"har-validator": "5.0.3",
"hawk": "6.0.2",
"http-signature": "1.2.0",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.18",
"oauth-sign": "0.8.2",
"performance-now": "2.1.0",
"qs": "6.5.1",
"safe-buffer": "5.1.1",
"stringstream": "0.0.5",
"tough-cookie": "2.3.4",
"tunnel-agent": "0.6.0",
"uuid": "3.2.1"
}
},
"rx": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz",
"integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I="
},
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"sntp": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
"integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
"requires": {
"hoek": "4.2.1"
}
},
"sshpk": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",
"integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=",
"requires": {
"asn1": "0.2.3",
"assert-plus": "1.0.0",
"bcrypt-pbkdf": "1.0.1",
"dashdash": "1.14.1",
"ecc-jsbn": "0.1.1",
"getpass": "0.1.7",
"jsbn": "0.1.1",
"tweetnacl": "0.14.5"
}
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg="
},
"topo": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
"integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=",
"requires": {
"hoek": "4.2.1"
}
},
"tough-cookie": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
"integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",
"requires": {
"punycode": "1.4.1"
}
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"requires": {
"safe-buffer": "5.1.1"
}
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"optional": true
},
"uuid": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
"integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA=="
},
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"requires": {
"assert-plus": "1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "1.3.0"
}
}
}
},
"wrappy": {
"version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}
}
}

View File

@ -9,10 +9,14 @@
"author": "~fyr",
"license": "MIT",
"dependencies": {
"colors": "^1.1.2",
"escape-string-regexp": "^1.0.5",
"livescript": "^1.5.0",
"once": "^1.4.0",
"promise-streams": "^2.1.1",
"pty.js": "^0.3.1",
"recursive-copy": "^2.0.7",
"split": "^1.0.1",
"stream-snitch": "0.0.3",
"wait-on": "^2.0.2"
}

View File

@ -1 +1 @@
https://ci-piers.urbit.org/zod-ccaffc55e6cd2f244e6fd1710479c05e1019c167.tgz
https://ci-piers.urbit.org/zod-b5aeee11e463f9338909ede5cee13d30883ea807.tgz

62
.travis/runner.ls Normal file
View File

@ -0,0 +1,62 @@
require! <[ stream stream-snitch colors escape-string-regexp ]>
pty = require \pty.js
export ERROR = /((ford|warn): |\r\x1b\[K\/~)/
export class Urbit
(args)->
@stdout = process.stdout # overridable
@pty = pty.spawn \urbit args
@pty.on \data ~> @stdout.write it # TODO pipe?
console.log "FIXME Running Ubuntu 14.04, which causes a libtinfo version info warning. Should update to 16.04."
#
@last-output = Date.now()
@pty.on \data ~> @last-output = Date.now()
#
@reset-listeners!
process.on \exit ~> @pty.write '\04' # send EOF to gracefully checkpoint
@pty.on \exit (code,signal)~>
| code => process.exit code
| signal => process.exit 128 + signal # repack exit code
| _ => #TODO report if unexpected?
#
note: (...args)-> console.log "\n#{'_'*40}\nnode:".blue, ...args
warn: (...args)-> console.log "\n#{'!'*40}\nnode:".red, ...args
wait-silent: ~> # this feels hacky
new Promise (resolve)~>
a = set-interval ~>
if Date.now! > @last-output + 1000
clear-interval a
resolve @last-output
, 200
#
reset-listeners: ~>
@pty.socket.unpipe @listeners
@pty.socket.pipe (@listeners = new stream.PassThrough)
@
every: (re, cb)~>
@listeners.pipe (new stream-snitch re).on "match" cb
expect: (re)~>
new Promise (resolve)~>
@listeners.pipe (new stream-snitch re).once "match" resolve
expect-immediate: (re)->
Promise.race [
@expect re
@wait-silent!then -> throw Error "Expected #re during event"
]
#
line: (s)->
@pty.write s
<~ @wait-silent!then
@stdout.write "\n"
@pty.write "\r"
#
expect-echo: (s)-> #ALT send-and-expect
<~ @line s .then
@expect new RegExp escape-string-regexp s
#
exit: (code)->
@pty.on \exit -> process.exit code #REVIEW just return promise?
# @pty.write "\03" # ^C running event
@pty.write "\05\25" # ^E^U to clear prompt
@pty.write "\04" # ^D to checkpoint
# set-timeout # hard exit

View File

@ -1,32 +1,62 @@
require! \stream-snitch
pty = require \pty.js
{Urbit,ERROR} = require './runner.ls'
urbit =
# TODO abort on failure
pty.spawn 'urbit' <[-B urbit.pill -A .. -cFI zod zod]>
.on \data -> process.stdout.write it
urbit.on \exit (code)->
console.log "\nnode: urbit exited with code #code\n"
process.exit code
console.log "FIXME Running Ubuntu 14.04, which causes a libtinfo version info warning. Should update to 16.04.\n"
fin = no
urbit.pipe (new stream-snitch /dojo> /g).on \match ->
return if fin
fin := yes
console.log "\n\n---\nnode: got dojo!\n---\n\n"
set-timeout (-> process.exit 0), 1000 # should probably test further
urbit.pipe (new stream-snitch /\n(\/~|ford: )/g).on \match ->
return if fin
fin := yes
console.log "\n\n---\nnode: detected error\n---\n\n"
set-timeout (-> process.exit 1), 1000
set-timeout ...
-> console.log "\n\n---\nnode: timed out after 5 min\n---"
5*60000
process.on \exit -> urbit.write '\04' # send EOF to gracefully checkpoint
urbit = new Urbit <[-B urbit.pill -A .. -cFI zod zod]>
Promise.resolve urbit
.then (urb)->
urb.note "Booting urbit"
Promise.race [
urb.expect ERROR .then ->
urb.warn "Boot error detected"
throw Error "Stack trace while booting"
, do
<- urb.expect /dojo> / .then
<- urb.expect-echo "%dojo-booted" .then
urb.reset-listeners!
]
.then (urb)->
urb.note "Testing compilation"
errs = {} #REVIEW stream reduce?
cur = "init"
urb.every />> (\/[ -~]+)/ ([_,path])-> cur := path
urb.every ERROR, ->
unless errs[cur]
errs[cur] = true
urb.warn "Compile error detected"
#
<- urb.line "|start %test" .then
<- urb.line ":test [%cores /]" .then
<- urb.expect-echo "%compilation-tested" .then
errs := Object.keys errs
if errs.length => throw Error "in #errs"
urb.reset-listeners!
.then (urb)->
urb.note "Testing renderers"
errs = {} #REVIEW stream reduce?
cur = "init"
urb.every />> (\[[ -~]+)/ ([_,ren])-> cur := ren
urb.every ERROR, ->
unless errs[cur]
errs[cur] = true
urb.warn "Renderer error detected"
#
<- urb.line ":test [%renders /]" .then
<- urb.expect-echo "%renderers-tested" .then
errs := Object.keys errs
if errs.length => throw Error "in #errs"
urb.reset-listeners!
.then (urb)->
urb.note "Running /===/tests"
errs = "" #REVIEW stream reduce?
urb.every /(\/[ -~]* (FAILED|CRASHED))/, ([_,result])->
if !errs => urb.warn "First error"
errs += "\n #result"
<- urb.line "+test, =defer |, =seed `@uvI`(shaz %reproducible)" .then
<- urb.expect-echo "%ran-tests" .then
if errs => throw Error errs
urb.reset-listeners!
.then ->
urbit.exit 0
.catch (err)->
<- urbit.wait-silent!then # assumptions?
urbit.warn "Test aborted:" err
urbit.exit 1

View File

@ -561,7 +561,7 @@
$tang ;;(tang q.q.cay)
$httr
=+ hit=;;(httr:eyre q.q.cay)
=- (flop (turn `wall`- |=(a/tape leaf+(dash:us a ''))))
=- (flop (turn `wall`- |=(a/tape leaf+(dash:us a '' ~))))
:- "HTTP {<p.hit>}"
%+ weld
(turn q.hit |=({a/@t b/@t} "{(trip a)}: {(trip b)}"))

View File

@ -1,4 +1,4 @@
:: Three ways we interactg with this app
:: Three ways we interact with this app
:: 1. .^(%gx /=gh=/endpoint)
:: 2. [%peer [our %gh] /endpoint]
:: 3. :gh &gh-poke %post /gists json-data

View File

@ -117,7 +117,7 @@
:> #
:> functional cores and arms.
::
|_ {bol/bowl:gall state}
|_ {bol/bowl:gall $1 state}
::
:> # %transition
:> prep transition
@ -125,12 +125,110 @@
++ prep
:> adapts state.
::
|= old/(unit state)
=> |%
++ states
$%({$1 s/state} {$0 s/state-0})
::
++ state-0
(cork state |=(a/state a(stories (~(run by stories.a) story-0))))
++ story-0
%+ cork story
|= a/story
%= a
shape *config-0
mirrors (~(run by mirrors.a) config-0)
peers (~(run by peers.a) |=(a/(list query) (turn a query-0)))
==
++ query-0
$? $: $circle
nom/name
wer/(unit circle)
wat/(set circle-data)
ran/range-0
==
query
==
++ config-0
{src/(set source-0) cap/cord tag/tags fit/filter con/control}
++ source-0
{cir/circle ran/range-0}
++ range-0
%- unit
$: hed/place-0
tal/(unit place-0)
==
++ place-0
$% {$da @da}
{$ud @ud}
{$sd @sd}
==
--
=| mos/(list move)
|= old/(unit states)
^- (quip move _..prep)
?~ old
%- pre-bake
ta-done:ta-init:ta
[~ ..prep(+<+ u.old)]
?- -.u.old
$1
[mos ..prep(+<+ u.old)]
::
$0
=- $(old `[%1 s.u.old(stories -)])
|^ %- ~(run by stories.s.u.old)
|= soy/story-0
^- story
%= soy
shape (prep-config shape.soy)
mirrors (~(run by mirrors.soy) prep-config)
peers %- ~(run by peers.soy)
|= a/(list query-0)
^- (list query)
(murn a prep-query)
==
::
++ prep-config
|= cof/config-0
^- config
%= cof
src
%- ~(gas in *(set source))
(murn ~(tap in src.cof) prep-source)
==
::
++ prep-source
|= src/source-0
^- (unit source)
=+ nan=(prep-range ran.src)
?~ nan
~& [%forgetting-source src]
~
`src(ran u.nan)
::
++ prep-query
|= que/query-0
^- (unit query)
?. ?=($circle -.que) `que
=+ nan=(prep-range ran.que)
?~ nan
~& [%forgetting-query que]
~
`que(ran u.nan)
::
++ prep-range
|= ran/range-0
^- (unit range)
?~ ran `ran
:: ranges with a relative end aren't stored because they end
:: immediately, so if we find one we can safely discard it.
?: ?=({$~ {$sd @sd}} tal.u.ran) ~
:: we replace relative range starts with the current date.
:: this is practically correct.
?: ?=({$sd @sd} hed.u.ran)
`ran(hed.u [%da now.bol])
`ran
--
==
::
:> # %engines
:> main cores.
@ -316,11 +414,13 @@
?- -.act
:: circle configuration
$create (action-create +.act)
$design (action-design +.act)
$source (action-source +.act)
$depict (action-depict +.act)
$filter (action-filter +.act)
$permit (action-permit +.act)
$delete (action-delete +.act)
$usage (action-usage +.act)
:: messaging
$convey (action-convey +.act)
$phrase (action-phrase +.act)
@ -384,6 +484,7 @@
%^ impact nom %new
:* [[[our.bol nom] ~] ~ ~]
des
~
*filter
:- typ
?. ?=(?($village $journal) typ) ~
@ -391,6 +492,14 @@
==
(ta-evil (crip "{(trip nom)}: already exists"))
::
++ action-design
:> creates a story with the specified config.
::
|= {nom/name cof/config}
?. (~(has in stories) nom)
(impact nom %new cof)
(ta-evil (crip "{(trip nom)}: already exists"))
::
++ action-delete
:> delete + announce
:>
@ -438,6 +547,15 @@
(ta-evil (crip "no story {(trip nom)}"))
so-done:(~(so-sources so nom ~ u.soy) sub srs)
::
++ action-usage
:> add or remove usage tags.
::
|= {nom/name add/? tas/tags}
=+ soy=(~(get by stories) nom)
?~ soy
(ta-evil (crip "no story {(trip nom)}"))
so-done:(~(so-usage so nom ~ u.soy) add tas)
::
:> # %messaging
+|
++ action-convey
@ -868,7 +986,8 @@
$bear (so-bear bur.rum)
$peer (so-delta-our rum)
$gram (so-open src nev.rum)
$remove (so-delta-our %config src %remove ~)
$remove ::TODO should also remove from {remotes}?
(so-delta-our %config src %remove ~)
::
$new
?: =(src so-cir)
@ -919,88 +1038,88 @@
:> state. in case of conflict, existing data is
:> overwritten.
::
::NOTE we don't use ++roll here because of urbit/arvo#447.
::
|= {gaz/(list telegram) cos/lobby pes/crowd}
^+ +>
~? (gth (lent gaz) 2.000)
[%unexpected-scrollback-length nom (lent gaz)]
=* self +>
::
:: local config
=. self
(so-config-full `shape loc.cos)
::
:: remote config
=. self
=+ rem=~(tap by rem.cos)
|- ^+ self
?~ rem self
=. self
(so-delta-our %config p.i.rem %full q.i.rem)
=* wer p.i.rem
=* cof q.i.rem
:: only make a delta if it actually changed.
=? self !=(`cof (~(get by mirrors) wer))
(so-delta-our %config wer %full cof)
$(rem t.rem)
::TODO eats previous change?
::%+ roll ~(tap by rem.cos)
::|= {{r/circle c/config} _self}
::(so-delta-our %config r %full c)
::
:: local status
=. self
=+ sas=~(tap by loc.pes)
|- ^+ self
?~ sas self
=. deltas
=* who p.i.sas
=* sat q.i.sas
:: only make a delta if it actually changed.
=? deltas !=(`sat (~(get by locals) who))
:_ deltas
:^ %story nom %status
[[our.bol nom] p.i.sas %full q.i.sas]
[[our.bol nom] who %full sat]
$(sas t.sas)
::TODO ideally do below, but runtime error at so-delta-our
::%+ roll ~(tap by loc.pes)
::|= {{w/ship s/status} _self}
::(so-delta-our %status so-cir w %full s)
::
:: remote status
=. self
=+ rem=~(tap by rem.pes)
|- ^+ self
?~ rem self
=. deltas
=* wer p.i.rem
=* gou q.i.rem
:: only make deltas if it actually changed.
=? deltas !=(`gou (~(get by remotes) wer))
%+ welp deltas
=+ gop=~(tap by q.i.rem)
=+ gop=~(tap by gou)
=+ hav=(fall (~(get by remotes) wer) *group)
=| l/(list delta)
|- ^+ l
?~ gop l
=. l [[%story nom %status p.i.rem p.i.gop %full q.i.gop] l]
=* who p.i.gop
=* sat q.i.gop
:: only make a delta if it actually changed.
=? l !=(`sat (~(get by hav) who))
[[%story nom %status wer who %full sat] l]
$(gop t.gop)
$(rem t.rem)
::TODO below eats state?
::%+ roll ~(tap by rem.pes)
::|= {{c/circle g/group} _self}
::%+ roll ~(tap by g)
::|= {{w/ship s/status} _self}
::(so-delta-our %status c w %full s)
::
:: telegrams
=. self
%_ self
deltas
%+ welp deltas
%- flop
%+ turn gaz
^- (list delta)
%+ murn gaz
|= t/telegram
^- delta
:+ %story nom
^- (unit delta)
:: in audience, replace above with us.
::TODO this really should be done by the sender.
=. aud.t
=+ dem=[(above our.bol) nom]
?. (~(has in aud.t) dem) aud.t
=+ (~(del in aud.t) dem)
(~(put in -) so-cir)
=+ num=(~(get by known) uid.t)
?: &(?=(^ num) =(t (snag u.num grams))) ~
::TODO this really should have sent us the message
:: src as well but that's not an easy fix.
:+ %gram [(above our.bol) nom]
:: in audience, replace above with us.
=- t(aud -)
=+ (~(del in aud.t) [(above our.bol) nom])
(~(put in -) so-cir)
`[%story nom %gram [(above our.bol) nom] t]
==
::TODO ideally do below, but runtime error
::%- so-deltas-our
::%+ turn gaz
::|= t/telegram
::^- delta-story
:::- %gram
:::: in audience, replace above with us.
::=- t(aud -)
::=+ (~(del in aud.t) [(above our.bol) nom])
::(~(put in -) so-cir)
:: inherited flag
%_(self deltas [[%story nom %inherited &] deltas])
::TODO runtime error
@ -1046,23 +1165,49 @@
~? &(?=(^ old) !=(src.u.old src.cof))
%maybe-missing-src-changes
%- so-deltas
%+ turn
%+ weld
^- (list delta-story)
?~ old ~
::TODO? what to do about src?
:~ ::[%follow | src.u.old]
[%config so-cir %permit | sis.con.u.old]
==
^- (list delta-story)
:~ ::[%follow & src.cof]
[%config so-cir %caption cap.cof]
[%config so-cir %filter fit.cof]
[%config so-cir %secure sec.con.cof]
[%config so-cir %permit & sis.con.cof]
=- %+ turn -
|= d/diff-config
[%story nom [%config so-cir d]]
^- (list diff-config)
::TODO figure out how to deal with src changes here.
:: %follow will probably behave a bit iffy in some cases.
?~ old
:: if we have no previous config, all diffs apply.
:~ [%caption cap.cof]
[%usage & tag.cof]
[%filter fit.cof]
[%secure sec.con.cof]
[%permit & sis.con.cof]
==
|= d/delta-story
[%story nom d]
=- (murn - same)
^- (list (unit diff-config))
=* col u.old
:: if we have previous config, figure out the changes.
:~ ?: =(cap.col cap.cof) ~
`[%caption cap.cof]
::
=+ gon=(~(dif in tag.col) tag.cof)
?~ gon ~
`[%usage | gon]
::
=+ new=(~(dif in tag.cof) tag.col)
?~ new ~
`[%usage & new]
::
?: =(fit.col fit.cof) ~
`[%filter fit.cof]
::
?: =(sec.con.col sec.con.cof) ~
`[%secure sec.con.cof]
::
=+ gon=(~(dif in sis.con.col) sis.con.cof)
?~ gon ~
`[%permit | gon]
::
=+ new=(~(dif in sis.con.cof) sis.con.col)
?~ new ~
`[%permit & new]
==
::
++ so-sources
:> change source
@ -1102,6 +1247,17 @@
?: =(cap cap.shape) +>
(so-delta-our %config so-cir %caption cap)
::
++ so-usage
:> add or remove usage tags.
::
|= {add/? tas/tags}
^+ +>
=/ sas/tags
%. tag.shape
?:(add ~(dif in tas) ~(int in tas))
?~ sas +>.$
(so-delta-our %config so-cir %usage add sas)
::
++ so-filter
:> change message rules
:>
@ -1187,29 +1343,34 @@
|= ran/range
^- (list telegram)
=+ [num=0 gaz=grams zeg=*(list telegram)]
:: fill in empty ranges to select all grams.
:: fill in empty ranges to select all grams,
:: and calculate absolutes for relative places.
=. ran
?~ ran `[[%ud 0] `[%ud count]]
?~ tal.u.ran `[hed.u.ran `[%ud count]]
=* hed hed.u.ran
?~ tal.u.ran `[hed `[%ud count]]
=* tal u.tal.u.ran
ran
:: never fails, but compiler needs it.
?> &(?=(^ ran) ?=(^ tal.u.ran))
=* hed hed.u.ran
=* tal u.tal.u.ran
%- flop
|- ^- (list telegram)
?~ gaz zeg
?: ?- -.u.tal.u.ran :: after the end
$ud (lth +.u.tal.u.ran num)
$da (lth +.u.tal.u.ran wen.i.gaz)
?: ?- -.tal :: after the end
$ud (lth +.tal num)
$da (lth +.tal wen.i.gaz)
==
:: if past the river, we're done searching.
:: if past the range, we're done searching.
zeg
?: ?- -.hed.u.ran :: before the start
$ud (lth num +.hed.u.ran)
$da (lth wen.i.gaz +.hed.u.ran)
?: ?- -.hed :: before the start
$ud (lth num +.hed)
$da (lth wen.i.gaz +.hed)
==
:: if before the river, continue onward.
:: if before the range, continue onward.
$(num +(num), gaz t.gaz)
:: if in the river, add this gram and continue.
:: if in the range, add this gram and continue.
$(num +(num), gaz t.gaz, zeg [i.gaz zeg])
::
++ so-in-range
@ -1225,16 +1386,18 @@
^- {in/? done/?}
?~ ran [& |]
=/ min
?- -.hed.u.ran
$ud (gth count +.hed.u.ran)
$da (gth now.bol +.hed.u.ran)
=* hed hed.u.ran
?- -.hed
$ud (gth count +.hed)
$da (gth now.bol +.hed)
==
?~ tal.u.ran
[min |]
=- [&(min -) !-]
?- -.u.tal.u.ran
$ud (gte +(+.u.tal.u.ran) count)
$da (gte +.u.tal.u.ran now.bol)
=* tal u.tal.u.ran
?- -.tal
$ud (gte +(+.tal) count)
$da (gte +.tal now.bol)
==
::
:> #
@ -1361,14 +1524,6 @@
=/ sus/(set ship)
%. sis.con.shape
?:(add ~(dif in sis) ~(int in sis))
=. +>.$
:: if banishing: notify only those affected.
:: if inviting: notify all targets.
=? sis !inv sus
=- (so-act [%phrase - [%inv inv so-cir]~])
%- ~(rep in `(set ship)`sis)
|= {s/ship a/audience}
(~(put in a) [s %inbox])
?~ sus +>.$
:: if banished, remove their presences.
=? +>.$ !inv
@ -2173,9 +2328,9 @@
:: only auto-federate channels for now.
?. ?=($channel sec.con.shape.s) ~
:+ ~ n
:: share no more than 2k messages at once, for performance reasons.
:+ ?: (lte count.s 2.000) grams.s
(slag (sub count.s 2.000) grams.s)
:: share no more than the last 100, for performance reasons.
:+ ?: (lte count.s 100) grams.s
(slag (sub count.s 100) grams.s)
[shape.s mirrors.s]
[locals.s remotes.s]
::
@ -2290,6 +2445,7 @@
?+ -.det %hasnot
$gram %grams
$new %config-l
$remove %config-l
$config ?: =(cir.det [our.bol nom])
%config-l %config-r
$status ?: =(cir.det [our.bol nom])
@ -2361,9 +2517,9 @@
$report
:: only send changes we didn't get from above.
?: =(src.bol (above our.bol)) ~
:: only send story reports about grams, status and peers.
:: only send story reports about grams and status.
?. ?=($story -.det) ~
?. ?=(?($gram $status $peer) -.det.det) ~
?. ?=(?($gram $status) -.det.det) ~
=+ soy=(~(got by stories) nom.det)
:: and only if the story is inherited.
?. inherited.soy ~
@ -2382,10 +2538,15 @@
?. =(nom.qer nom.det) ~
?. %- circle-feel-story
[wer.qer wat.qer nom.det det.det] ~
=/ sor (~(got by stories) nom.qer)
?. =< in %. ran.qer
~(so-in-range so:ta nom.qer ~ sor) ~
?. ?=(?($gram $new $config $status) -.det.det) ~
?. ?| ?=($remove -.det.det)
::
=< in %. ran.qer
=+ soy=(~(got by stories) nom.qer)
~(so-in-range so:ta nom.qer ~ soy)
==
~
=+ out=?($gram $new $config $status $remove)
?. ?=(out -.det.det) ~
:+ ~ %circle
?+ det.det det.det
{$gram *}
@ -2639,11 +2800,10 @@
|= pax/path
^- (quip move _+>)
%- pre-bake
:_ ~
=+ qer=(path-to-query %circle pax)
?> ?=($circle -.qer)
:+ %story nom.qer
[%peer | src.bol qer]
?. (~(has by stories) nom.qer) ~
[%story nom.qer %peer | src.bol qer]~
::
++ reap
:> subscription n/ack

View File

@ -115,16 +115,12 @@
::
::
++ from-module :: create wrapper
=+ [%module ..$ _abet]:(hood-module)
|% +- $
=> .(+< [identity start finish]=+<)
=- [wrap=- $:start] :: usage (wrap handle-arm):from-foo
=+ handle=finish
|% +- $
|: +<.handle
=. +>.handle (start hid (able identity))
(ably (handle +<))
-- --
|* _[identity=%module start=..$ finish=_abet]:(hood-module)
=- [wrap=- *start] :: usage (wrap handle-arm):from-foo
|* handle/_finish
|= a=_+<.handle
=. +>.handle (start hid (able identity))
(ably (handle a))
::
:: per-module interface wrappers
++ from-drum (from-module %drum [..$ _se-abet]:(hood-drum))
@ -144,6 +140,7 @@
++ coup-kiln-spam (wrap take-coup-spam):from-kiln
++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum
++ init-helm |=({way/wire *} [~ +>])
++ mack-kiln (wrap mack):from-kiln
++ made-write (wrap made):from-write
++ made-kiln (wrap take-made):from-kiln
++ mere-kiln (wrap take-mere):from-kiln
@ -197,6 +194,7 @@
++ poke-kiln-overload (wrap poke-overload):from-kiln
++ poke-kiln-unmount (wrap poke-unmount):from-kiln
++ poke-kiln-unsync (wrap poke-unsync):from-kiln
++ poke-kiln-permission (wrap poke-permission):from-kiln
++ poke-womb-invite (wrap poke-invite):from-womb
++ poke-womb-save (wrap poke-save):from-womb
++ poke-womb-obey (wrap poke-obey):from-womb

View File

@ -29,9 +29,10 @@
|%
++ state :> application state
$: :: messaging state ::
count/@ud :< (lent grams)
grams/(list telegram) :< all history
known/(map serial @ud) :< messages heard
last/@ud :< last heard
count/@ud :< (lent grams)
sources/(set circle) :< our subscriptions
:: circle details ::
remotes/(map circle group) :< remote presences
@ -112,7 +113,7 @@
:> #
:> functional cores and arms.
::
|_ {bol/bowl:gall state}
|_ {bol/bowl:gall $1 state}
::
:> # %transition
:> prep transition
@ -121,11 +122,74 @@
++ prep
:> adapts state
::
|= old/(unit state)
=> |%
++ states
$%({$1 s/state} {$0 s/state-0})
::
++ state-0
(cork state |=(a/state a(mirrors (~(run by mirrors.a) config-0))))
++ config-0
{src/(set source-0) cap/cord tag/tags fit/filter con/control}
++ source-0
{cir/circle ran/range-0}
++ range-0
%- unit
$: hed/place-0
tal/(unit place-0)
==
++ place-0
$% {$da @da}
{$ud @ud}
{$sd @sd}
==
--
=| mos/(list move)
|= old/(unit states)
^- (quip move _..prep)
?~ old
ta-done:ta-init:ta
[~ ..prep(+<+ u.old)]
?- -.u.old
$1
[mos ..prep(+<+ u.old)]
::
$0
=. mos [[ost.bol %pull /server/inbox server ~] peer-inbox mos]
=- $(old `[%1 s.u.old(mirrors -)])
|^
(~(run by mirrors.s.u.old) prep-config)
::
++ prep-config
|= cof/config-0
^- config
%= cof
src
%- ~(gas in *(set source))
(murn ~(tap in src.cof) prep-source)
==
::
++ prep-source
|= src/source-0
^- (unit source)
=+ nan=(prep-range ran.src)
?~ nan
~& [%forgetting-source src]
~
`src(ran u.nan)
::
++ prep-range
|= ran/range-0
^- (unit range)
?~ ran `ran
:: ranges with a relative end aren't stored because they end
:: immediately, so if we find one we can safely discard it.
?: ?=({$~ {$sd @sd}} tal.u.ran) ~
:: we replace relative range starts with the current date.
:: this is practically correct.
?: ?=({$sd @sd} hed.u.ran)
`ran(hed.u [%da now.bol])
`ran
--
==
::
:> #
:> # %utility
@ -218,7 +282,10 @@
server
::
%+ welp /circle/[inbox]/grams/config/group
?:(=(0 count) ~ [(scot %ud count) ~])
?. =(0 count)
[(scot %ud last) ~]
=+ history-days=~d5
[(scot %da (sub now.bol history-days)) ~]
==
::
:> #
@ -359,7 +426,7 @@
~&([%unexpected-circle-rumor -.rum] +>)
::
$gram
(ta-learn gam.nev.rum)
(ta-open nev.rum)
::
$config
=+ cur=(fall (~(get by mirrors) cir.rum) *config)
@ -445,15 +512,16 @@
::
|= nes/(list envelope)
^+ +>
(ta-lesson (turn nes tail))
?~ nes +>
$(nes t.nes, +> (ta-open i.nes))
::
++ ta-lesson
:> learn all telegrams in a list.
++ ta-open
:> learn message from an envelope.
::
|= gaz/(list telegram)
|= nev/envelope
^+ +>
?~ gaz +>
$(gaz t.gaz, +> (ta-learn i.gaz))
=? last (gth num.nev last) num.nev
(ta-learn gam.nev)
::
++ ta-learn
:> save/update message
@ -687,7 +755,7 @@
;~ pose
(cold [%da now.bol] (jest 'now'))
(stag %da (drat hed))
(stag %ud dem:ag)
placer
==
::
++ rang :< subscription range
@ -1180,7 +1248,11 @@
::
|= {inv/? nom/name sis/(set ship)}
^+ ..sh-work
(sh-act %permit nom inv sis)
=. ..sh-work (sh-act %permit nom inv sis)
=- (sh-act %phrase - [%inv inv [self nom]]~)
%- ~(rep in sis)
|= {s/ship a/audience}
(~(put in a) [s %inbox])
::
++ filter
|= {nom/name cus/? utf/?}
@ -1828,6 +1900,7 @@
$(dif [%filter fit.cof.dif])
?: ?=($remove -.dif)
(sh-note (weld "rip " (~(cr-show cr cir) ~)))
?: ?=($usage -.dif) +>
%- sh-note
%+ weld
(weld ~(cr-phat cr cir) ": ")
@ -2339,9 +2412,8 @@
?: pat.sep " "
=- (weld - q:(fall pre [p=| q=" "]))
%~ ar-glyf ar
?: =(who self) aud
(~(del in aud) [who %inbox])
==
?: =(who self) aud
(~(del in aud) [who %inbox])
=/ lis/(list tape)
%+ simple-wrap
`tape``(list @)`(tuba (trip msg.sep))
@ -2445,7 +2517,7 @@
==
?: =(a 'reset')
~& 'full reset incoming, hold on to your cli...'
:_ +>(grams ~, known ~, count 0)
:_ +>(grams ~, known ~, count 0, last 0)
:~ [ost.bol %pull /server/client server ~]
[ost.bol %pull /server/inbox server ~]
peer-client

162
app/test.hoon Normal file
View File

@ -0,0 +1,162 @@
::
|%
++ test
$% [%arvo ~] ::UNIMPLEMENTED
[%marks ~] ::UNIMPLEMENTED
[%cores p=path]
[%hoons p=path]
[%names p=path]
[%renders p=path]
==
--
::
|%
++ join
|= {a/cord b/(list cord)}
?~ b ''
(rap 3 |-([i.b ?~(t.b ~ [a $(b t.b)])]))
::
++ fake-fcgi [%many [%blob *cred:eyre] $+[%n ~] ~]
--
::
=, gall
=, ford
=, format
|_ {bowl $~}
++ peek _~
++ report-error
|= [a=spur b=(each cage tang)] ^- tang
=/ should-fail (~(get by failing) (flop a))
?- -.b
%&
?~ should-fail ~
:~ leaf+"warn: expected failure, {<`tape`u.should-fail>}"
leaf+"warn: built succesfully"
(sell q.p.b)
==
::
%|
?^ should-fail
~[>[%failed-known `tape`(weld "TODO: " u.should-fail)]<]
(flop p.b)
==
::
++ made-a-core
|= {a/spur @uvH b/gage}
:_ +>.$
?> ?=([%tabl [(each) (each)] ~] b)
%- (slog (report-error a p.i.p.b))
=/ nex/(list spur)
=<(p ;;(,[%& %cont * p=(list spur)] q.i.p.b))
?~ nex ~&(%cores-tested ~)
[ost (build-core nex)]~
::
++ build-core
|= [a=spur b=(list spur)]
~& >> (flop a)
:^ %exec a-core+a our
%- some
^- bilk
:- now-beak
:~ %tabl
[[%core now-beak a] [%$ %cont !>(b)]]
==
::
++ made-a-rend
|= {a/wire @uvH b/gage}
?> ?=([ren=mark ~] a)
=+ `[ren=term pax=path]`?~(a !! a)
:_ +>.$
?> ?=([%tabl [(each) (each)] ~] b)
%- (slog (report-error /[ren.i.a]/ren p.i.p.b))
=/ nex/(list term)
=<(p ;;(,[%& %cont * p=(list term)] q.i.p.b))
?~ nex ~&(%rens-tested ~)
[ost (build-rend nex)]~
::
++ build-rend
|= [a=term b=(list term)]
~& >> [%ren a]
=/ bem/beam (need (de-beam %/example))
=. -.bem now-beak
:^ %exec a-rend+/[a] our
%- some
^- bilk
:- -.bem
:~ %tabl
[`silk`[%bake a fake-fcgi bem] [%$ %cont !>(b)]]
==
::
++ poke-noun
|= a=test
:_ +>
?- -.a
%arvo ~|(%stub !!) ::basically double solid?
%hoons ~&((list-hoons p.a ~) ~)
%cores [ost (build-core [- +]:(list-hoons p.a skip=(sy /sys /ren ~)))]~
%names ~&((list-names p.a) ~)
%marks ~|(%stub !!) ::TODO restore historical handler
%renders [ost (build-rend [- +]:(list-names (weld /ren p.a)))]~
==
::
++ list-names
|= a/path ^- (list term)
=/ hon (list-hoons a ~)
%+ turn hon
|= b=spur
(join '-' (slag 1 (flop b)))
::
++ list-hoons
|= [under=path skipping=(set spur)] ^- (list spur)
=/ sup (flop under)
~& [%findining-hoons under=under]
|- ^- (list spur)
%- zing
%+ turn
=- (sort ~(tap by -) aor)
dir:.^(arch %cy (en-beam now-beak sup))
|= [a=knot ~] ^- (list spur)
=. sup [a sup]
?: (~(has in skipping) (flop sup))
~&(> [(flop sup) %out-of-scope] ~)
=/ ded (~(get by skip-completely) (flop sup))
?^ ded
~&(> [(flop sup) %skipped `tape`u.ded] ~)
?~ [fil:.^(arch %cy (en-beam now-beak [%hoon sup]))]
^$
~& (flop sup)
[sup ^$]
::
++ now-beak %_(byk r [%da now])
++ skip-completely
^~ ^- (map path tape)
%- my :~ ::TODO don't hardcode
:- /ren/css "not meant to be called outside /web/pack"
:- /ren/js "not meant to be called outside /web/pack"
:- /ren/run "not meant to be called except on a (different) hoon file"
::
:- /app/gh "hangs for some reason"
:- /mar/gh "hangs for some reason"
:- /app/twit "slow and/or crash"
:- /gen/twit "slow and/or crash"
:- /mar/twit "slow and/or crash"
==
::
++ failing
^~ ^- (map path tape)
%- my :~ ::TODO don't hardcode
::
:- /app/pipe "wants 'flavor:hall' to exist"
:- /gen/capitalize "wants unicode-data/txt"
::
:- /lib/down-jet/parse "// nonsense"
:- /lib/down-jet/rend "// nonsense"
:- /lib/hood/kiln "ford can't handle surs from libs"
:- /lib/sole "ford can't handle surs from libs"
:- /lib/hall "ford can't handle surs from libs"
:- /lib/twitter "ford can't handle surs from libs"
:- /sys/arvo "BROKEN"
:- /sys/vane/jael "expects our"
:- /sys/vane/xmas "expects our"
==
--

9
app/test/example.md Normal file
View File

@ -0,0 +1,9 @@
---
comments: true
---
# Static
You can put static files in here to serve them to the web. Actually, you can put static files anywhere in `/web` and see them in a browser.
Docs on static publishing with urbit are forthcoming — but feel free to drop markdown files in `/web` to try it out.

View File

@ -195,11 +195,11 @@
|= {usr/(unit user:eyre) req/(unit user:eyre)}
?~(req & =(usr req))
::
:: .^(twit-feed %gx /=twit=/~/home/urbit_test)
:: .^(twit-stat %gx /=twit=/~./post/0vv0old.0post.hash0.0000)
++ peek
|= {ren/care:clay pax/path} ^- (unit (unit gilt))
?> ?=($x ren) :: others unsupported
:: /+ twitter
:: .^((list post:twitter) %gx /=twit=/home/urbit_test/twit-feed)
:: .^(post:twitter %gx /=twit=/post/0vv0old.0post.hash0.0000/twit-feed)
++ peek-x
|= pax/path ^- (unit (unit gilt))
=+ usr=`~. :: =^ usr pax (user-from-path pax)
?. ?=(twit-path pax)
~|([%missed-path pax] !!)
@ -213,7 +213,7 @@
++ peer-scry-x
|= pax/path ^+ done
:_ +>
=+ pek=(peek %x pax)
=+ pek=(peek-x pax)
?^ pek
?~ u.pek ~|(bad-scry+x+pax !!)
~[[ost %diff u.u.pek] [ost %quit ~]]

View File

@ -17,9 +17,21 @@
~| plural-stub+a ::TODO expand
%- trip
%+ snag a ^~
%+ weld
/no/''/two/three/four/five/six/seven/eight/nine/ten/elven/twelve
/thirteen/fourteen/fifteen/sixteen/seventeen/eighteen/nineteen/twenty
;: weld
/no/''/two/three/four/five/six/seven/eight/nine/ten
/eleven/twelve/thirteen/fourteen/fifteen/sixteen
/seventeen/eighteen/nineteen/twenty/twenty-one
/twenty-two/twenty-three/twenty-four/twenty-five
/twenty-six/twenty-seven/twenty-eight/twenty-nine
/thirty/thirty-one/thirty-two/thirty-three
/thirty-four/thirty-five/thirty-six/thirty-seven
/thirty-eight/thirty-nine/forty/forty-one/forty-two
/forty-three/forty-four/forty-five/forty-six
/forty-seven/forty-eight/forty-nine/fifty/fifty-one
/fifty-two/fifty-three/fifty-four/fifty-five
/fifty-six/fifty-seven/fifty-eight/fifty-nine/sixty
/sixty-one/sixty-two/sixty-three/sixty-four
==
::
++ type $%({$planets planets/@u} {$stars stars/@u})
--

View File

@ -8,7 +8,6 @@
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{arg/$@(~ {tym/@dr ~}) ~}
{{recur/@dr start/@da ~} ~}
==
?~ arg $(arg [~h4 ~])
[%kiln-overload tym.arg]
[%kiln-overload recur start]

10
gen/hood/private.hoon Normal file
View File

@ -0,0 +1,10 @@
:: Kiln: make (subtree in) desk privately readable.
::
:::: /gen/hood/private/hoon
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{arg/{des/desk may/?($~ {pax/path $~})} $~}
==
:- %kiln-permission
[des ?~(may / pax.may) |]:arg

10
gen/hood/public.hoon Normal file
View File

@ -0,0 +1,10 @@
:: Kiln: make (subtree in) desk publicly readable.
::
:::: /gen/hood/public/hoon
::
:- %say
|= $: {now/@da eny/@uvJ bec/beak}
{arg/{des/desk may/?($~ {pax/path $~})} $~}
==
:- %kiln-permission
[des ?~(may / pax.may) &]:arg

View File

@ -22,18 +22,4 @@
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
=/ mon (mix (lsh 5 1 (end 5 1 eny)) p.bec)
=/ tic .^(@ /a/(scot %p p.bec)/tick/(scot %da now)/(scot %p mon))
%+ sole-yo
leaf+"(see https://github.com/urbit/arvo/issues/327 for details)"
%+ sole-yo
:- %leaf
;: weld
"WARNING: linking a moon to your "
?-(ran $czar "galaxy", $king "star", $duke "planet")
" can cause networking bugs"
==
%+ sole-lo
[& %$ "enter y/yes to continue: "]
|= inp/tape
?. |(=("y" inp) =("yes" inp))
(sole-so [%tang leaf+"canceled" ~])
(sole-so [%tang leaf+"moon: {<`@p`mon>}; ticket: {<`@p`tic>}" leaf+"" ~])
(sole-so [%tang leaf+"ticket: {<`@p`tic>}" leaf+"moon: {<`@p`mon>}" ~])

View File

@ -10,42 +10,50 @@
++ test-runner
:> run all tests in {a} with a filter.
=| pax=path
|= [filter=path eny=@uvJ a=tests:tester]
|= [filter=path [defer=? eny=@uvJ] a=tests:tester]
^- tang
%- concat:ls
%+ turn a
|= b=instance:tester
^- tang
=; tan/tang
?: defer tan
((slog (flop tan)) ~)
=^ matches filter (match-filter filter p.b)
?. matches
~
?- -.q.b
%& (run-test [p.b pax] eny p.q.b)
%| ^$(pax [p.b pax], a p.q.b)
%&
(run-test [p.b pax] eny p.q.b)
::
%|
^$(pax [p.b pax], a p.q.b)
==
::
++ run-test
:> executes an individual test.
|= [pax=path eny=@uvJ test=$-(@uvJ (list tape))]
|= [pax=path eny=@uvJ test=$-(@uvJ (list tank))]
^- tang
=+ name=(spud (flop pax))
=+ run=(mule |.((test eny)))
?- -.run
%| :: the stack is already flopped for output?
;: weld
p:run
p.run
`tang`[[%leaf (weld name " CRASHED")] ~]
==
%& ?: =(~ p:run)
%& ?: =(~ p.run)
[[%leaf (weld name " OK")] ~]
:: Create a welded list of all failures indented.
%- flop
;: weld
`tang`[[%leaf (weld name " FAILED")] ~]
%+ turn p:run
|= {i/tape}
^- tank
[%leaf (weld " " i)]
::TODO indent
:: %+ turn p:run
:: |= {i/tape}
:: ^- tank
:: [%leaf (weld " " i)]
p.run
==
==
::
@ -62,10 +70,11 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[filter=$?(~ [pax=path ~])]
~
[defer=_& seed=?(~ @uvJ)]
==
~? !defer %test-compiled
:- %tang
%^ test-runner
?~ filter ~ pax.filter
eny
%^ test-runner
?~(filter ~ pax.filter)
[defer ?~(seed eny seed)]
(test-map-to-test-list:tester all-tests)

View File

@ -11,4 +11,4 @@
|= $: {now/@da eny/@uvJ bec/beak}
{{who/knot msg/cord ~} ~}
==
[%twit-do [who %post eny msg]]
[%twit-do [who %post `@uvI`(rsh 8 1 eny) msg]]

View File

@ -13,7 +13,7 @@
|= $: {now/@da eny/@uvJ bek/beak}
{{who/iden ~} typ/?($user $home)}
==
=+ pax=/(scot %p p.bek)/twit/(scot %da now)/[typ]/[who]
=+ pax=/(scot %p p.bek)/twit/(scot %da now)/[typ]/[who]/twit-feed
:- %tang
%+ turn (flop .^((list post:twitter) %gx pax))
|= post:twitter ^- tank

View File

@ -178,6 +178,7 @@
$full (conf cof.a)
$source (pairs add+b+add.a src+(sorc src.a) ~)
$caption s+cap.a
$usage (pairs add+b+add.a tas+(sa tas.a cord) ~)
$filter (filt fit.a)
$secure s+sec.a
$permit (pairs add+b+add.a sis+(sa sis.a ship) ~)
@ -229,6 +230,7 @@
%- pairs :~
src+(sa src.a sorc)
cap+s+cap.a
tag+(sa tag.a cord)
fit+(filt fit.a)
con+(cont con.a)
==
@ -425,6 +427,7 @@
%- of :~
full+conf
source+(ot add+bo src+sorc ~)
usage+(ot add+bo tas+(as so) ~)
caption+so
filter+filt
secure+secu
@ -469,6 +472,7 @@
%- ot :~
src+(as sorc)
cap+so
tag+(as so)
fit+filt
con+cont
==

View File

@ -66,10 +66,19 @@
|= ran/range
^- path
?~ ran ~
%+ welp
/(scot -.hed.u.ran +.hed.u.ran)
:- (place-to-knot hed.u.ran)
?~ tal.u.ran ~
/(scot -.u.tal.u.ran +.u.tal.u.ran)
[(place-to-knot u.tal.u.ran) ~]
::
++ place-to-knot
:> msg pointer to path component
:>
:> turns a place structure into a knot for use in
:> subscription paths.
::
|= pla/place
^- knot
(scot -.pla +.pla)
::
++ path-to-range
:> path to msg range
@ -80,18 +89,23 @@
|= pax/path
^- range
?~ pax ~
=/ hes/(unit place) (rush i.pax placer)
:: skip past non-number parts of path.
?: ?=({~ ~} [(slaw %da i.pax) (slaw %ud i.pax)])
$(pax t.pax)
:+ ~
=+ hed=(slaw %da i.pax)
?^ hed [%da u.hed]
[%ud (slav %ud i.pax)]
?~ hes $(pax t.pax)
:+ ~ u.hes
?~ t.pax ~
:- ~
=+ tal=(slaw %da i.t.pax)
?^ tal [%da u.tal]
[%ud (slav %ud i.t.pax)]
(rush i.t.pax placer)
::
++ placer
:> parse a range place
;~ pose
(stag %ud dem:ag)
::
=- (stag %da (sear - ;~(pfix sig crub:so)))
|= a/dime
^- (unit @da)
?:(?=($da p.a) `q.a ~)
==
::
++ change-glyphs :< ...
::
@ -126,6 +140,15 @@
$caption cof(cap cap.dif)
$filter cof(fit fit.dif)
$remove cof
::
$usage
%= cof
tag
%. tas.dif
?: add.dif
~(uni in tag.cof)
~(dif in tag.cof)
==
::
$source
%= cof

View File

@ -392,8 +392,9 @@
++ se-show :: show buffer, raw
|= lin/(pair @ud stub)
^+ +>
=. p.lin (add p.lin (lent-stye:klr q.lin))
?: =(mir lin) +>
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop (add p.lin (lent-stye:klr q.lin))))
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin))
=. +> ?:(=(q.mir q.lin) +> (se-blit %pom q.lin))
+>(mir lin)
::
@ -401,13 +402,13 @@
|= {pom/stub lin/(pair @ud (list @c))}
^+ +>
=/ pol (lent-char:klr pom)
=/ end (sub edg pol)
=/ pos (add pol p.lin)
?: (gte (div (mul pol 100) edg) 35) :: old style (long prompt)
=/ off ?:((lte p.lin end) 0 (sub p.lin end))
=/ off ?:((lte pos edg) 0 (sub pos edg))
%+ se-show
(sub pos off)
(swag:klr [off edg] (welp pom [*stye q.lin]~))
=/ end (sub edg pol)
=. off ?: (gth p.lin (add end off))
(sub p.lin end)
?: (lth p.lin off)

View File

@ -67,6 +67,7 @@
{$dirk wire @tas} ::
{$ogre wire $@(@tas beam)} ::
{$merg wire @p @tas @p @tas case germ} ::
{$perm wire ship desk path rite} ::
{$poke wire dock pear} ::
{$wipe wire @p ~} ::
{$wait wire @da} ::
@ -185,6 +186,12 @@
=+ old=;;((map @da cord) (fall (file where) ~))
`(foal where %sched !>((~(put by old) tym eve)))
::
++ poke-permission
|= {syd/desk pax/path pub/?}
=< abet
%^ emit %perm /kiln/permission
[our syd pax %r ~ ?:(pub %black %white) ~]
::
++ poke-autoload |=(lod/(unit ?) abet:(poke:autoload lod))
++ poke-start-autoload |=(~ abet:start:autoload)
::
@ -262,11 +269,18 @@
--
::
++ poke-overload
|= tym/@dr
abet:(emit %wait /kiln/overload/(scot %dr tym) (add ~s10 now))
:> +poke-overload: wipes ford cache at {start}, and then every {recur}.
|= [recur=@dr start=@da]
?> (gte start now)
abet:(emit %wait /kiln/overload/(scot %dr recur) start)
::
++ poke-wipe-ford |=(~ abet:(emit %wipe /kiln our ~))
::
++ mack
|= {way/wire saw/(unit tang)}
~? ?=(^ saw) [%kiln-nack u.saw]
abet
::
++ take |=(way/wire ?>(?=({@ ~} way) (work i.way))) :: general handler
++ take-mere ::
|= {way/wire are/(each (set path) (pair term tang))}
@ -274,6 +288,14 @@
::
++ take-made ::
|= {way/wire dep/@uvH reg/gage:ford}
:: hack for |overload
::
:: We might have gotten an ignorable response back for our cache priming
:: ford call. If it matches our magic wire, ignore it.
::
?: =(/prime/cache way)
~& %cache-primed
abet
abet:abet:(made:(take way) dep reg)
::
++ take-coup-fancy ::
@ -319,6 +341,19 @@
|= {way/wire ~}
?> ?=({@ ~} way)
=+ tym=(slav %dr i.way)
:: this builds up a ford build for the front page to prime the cache.
=. +>.$
=/ request-data :~
[0 [0 8.080] 0 'localhost' ~]
:: associate 0 as the anonymous ship, which is the ++add result.
[[0 (scot %p (add our ^~((bex 64))))] ~ ~]
'not-yet-implemented'
`'en-US,en;q=0.9'
`.127.0.0.1
==
=/ monies/coin [%many ~[[%blob request-data] [%$ ~.n 0]]]
=/ request/silk:ford [%bake %urb monies [our %home [%da now]] /web]
(emit `card`[%exec /kiln/prime/cache our `[[our %home [%da now]] request]])
=. +>.$
(emit %wipe /kiln/overload/[i.way] our ~)
=. +>.$

View File

@ -55,7 +55,7 @@
|= {a/purl b/quay} ^- hiss
=. b (quay:hep-to-cab b)
=- [a %post - ?~(b ~ (some (as-octt +:(tail:en-purl:html b))))]
(my content-type+['application/x-www-form-en-urlt:htmlncoded']~ ~)
(my content-type+['application/x-www-form-urlencoded']~ ~)
::
::
++ mean-wall !.

View File

@ -13,7 +13,7 @@
::
+= instance
:> a mapping between a term and part of a test tree.
(pair term (each $-(@uvJ (list tape)) tests))
(pair term (each $-(@uvJ (list tank)) tests))
::
:> # %generate
:> utilities for generating ++tests from files and directories.
@ -22,7 +22,7 @@
:> combine the current file and subdirectory.
:>
:> this merges the file {base} with its child files {recur}.
|= [base=vase recur=(map @ta tests:tester)]
|= [base=vase recur=(map @ta tests)]
^- tests
=+ a=(gen-tests base)
=+ b=(test-map-to-test-list recur)
@ -33,43 +33,47 @@
++ test-map-to-test-list
:> translates ford output to something we can work with.
:>
:> ford gives us a `(map @ta tests:tester)`, but we actually
:> ford gives us a `(map @ta tests)`, but we actually
:> want something like ++tests.
|= a=(map @ta tests:tester)
|= a=(map @ta tests)
:: todo: i'd like to sort this, but ++sort has -find.a problems much like
:: ++weld does above!?
^- tests
%+ turn
(to-list:dct:new-hoon a)
|= {key/@ta value/tests:tester}
|= {key/@ta value/tests}
[key [%| value]]
::
++ has-test-prefix
|= a=term ^- ?
?| =((end 3 5 a) 'test-')
=((end 3 6 a) 'check-')
==
::
++ gen-tests
:> creates a {tests} list out of a vase of a test suite
|= v=vase
^- tests
=+ arms=(sort (sloe p.v) aor)
%+ turn arms
%+ turn (skim arms has-test-prefix)
|= arm/term
::REVIEW fewer asserts? recouple the nock and eat the runtime compile cost?
?> (~(nest ut (~(peek ut p.v) %free 6)) & p:!>((init-test)))
=/ call (~(mint ut p.v) p:!>(*tang) [%limb arm])
?> (~(nest ut p:!>(*tang)) & p.call)
::
:- arm
:- %&
|= eny=@uvJ
=+ context=(slop !>((init-test eny)) v)
=/ r (slap context [%cnsg [arm ~] [%$ 3] [[%$ 2] ~]])
((hard (list tape)) q:(slap r [%limb %results]))
|= eny=@uvJ ^- tang
((hard tang) .*(q.v(+6 (init-test eny)) q.call))
::
:> # %per-test
:> data initialized on a per-test basis.
::
++ init-test
|= {cookie/@uvJ}
~(. tester `(list tape)`~ cookie 10 0)
::
++ tester-type _(init-test `@uvJ`0)
++ init-test |=({eny/@uvJ} %*(. tester eny eny, check-iterations 10))
::
++ tester
|_ $: error-lines=(list tape) :< output messages
eny=@uvJ :< entropy
|_ $: eny=@uvJ :< entropy
check-iterations=@u :< # of check trials
current-iteration=@u :< current iteration
==
@ -80,27 +84,21 @@
+|
+- check
|* [generator=$-(@uvJ *) test=$-(* ?)]
|-
^+ +>.$
|- ^- tang
?: (gth current-iteration check-iterations)
+>.$
~
:: todo: wrap generator in mule so it can crash.
=+ sample=(generator eny)
:: todo: wrap test in mule so it can crash.
=+ ret=(test sample)
?: ret
?: (test sample)
%= $
eny (shaf %huh eny) :: xxx: better random?
current-iteration (add current-iteration 1)
==
=+ case=(add 1 current-iteration)
=+ case-plural=?:(=(case 1) "case" "cases")
%= +>.$
error-lines :*
"falsified after {(noah !>(case))} {case-plural} by '{(noah !>(sample))}'"
error-lines
==
==
=/ case +(current-iteration)
=/ pl ?+(case "" %1 "s")
::XXX sample is a noun
[leaf+"falsified after {<case>} case{pl} by '{<`*`sample>}', seed {<eny>}"]~
::
:: todo: a generate function that takes an arbitrary span.
::
@ -139,27 +137,23 @@
+|
:: todo: unit testing libraries have a lot more to them than just eq.
++ expect-eq
|* [a=* b=* c=tape]
^+ +>
?: =(a b)
+>.$
%= +>.$
error-lines :*
"failure: '{c}'"
" actual: '{(noah !>(a))}'"
" expected: '{(noah !>(b))}'"
error-lines
==
|= a=vase
^- tang
?@ q.a [palm+[": " ~ ~ ~]^~[>%ex-expected-pair< (sell a)]]~
?: =(-.q.a +.q.a)
~
:~ palm+[": " ~ ~ ~]^~[leaf+"expected" (sell (slot 2 a))]
palm+[": " ~ ~ ~]^~[leaf+"actual" (sell (slot 3 a))]
==
::
:> #
:> # %output
:> # %formatting
:> #
:> called by the test harness
::
++ results
:> returns results.
^- (list tape)
error-lines
:> test result presentation
+|
++ category
|= [a=tape b=tang] ^- tang
?: =(~ b) ~ :: test OK
:- leaf+"in: '{a}'"
(turn b |=(c=tank rose+[~ " " ~]^~[c]))
--
--

View File

@ -20,7 +20,7 @@
|= {a/char b/(list @t)} ^- @t
%+ rap 3
?~ b ~
|-(?~(t.b b [i.b a $(b t.b)]))
|-(?~(t.b b [i.b a $(b t.b)]))
::
++ valve :: produce request
|= {med/?($get $post) pax/path quy/quay}
@ -87,9 +87,10 @@
:~ id+ni
user+(ot (fasp screen-name+(su user)) ~)
(fasp created-at+(cu year (ci stud so)))
text+(cu crip (su (star escp:de-xml))) :: parse html escapes
:: parse html escapes and newlines
text+(cu crip (su (star ;~(pose (just `@`10) escp:de-xml))))
==
++ usel
++ usel
=, ^?(dejs)
%+ ce (list who/@ta)
=- (ot users+(ar -) ~)
@ -119,12 +120,12 @@
(valve med (cowl pax +.a b))
::
++ lutt |=(@u `@t`(rsh 3 2 (scot %ui +<)))
++ llsc
++ llsc
:: => args:reqs
|: a=$:$@(scr (list scr)) ^- @t
?@(a `@t`a (join ',' a))
::
++ llst
++ llst
|= a/$@(@t (list @t)) ^- @t
?@(a `@t`a (join ',' a))
::
@ -135,9 +136,9 @@
?@(a (lutt a) (join ',' (turn `(list tid)`a lutt)))
::
++ cowl :: handle parameters
|: :* pax=*path
ban=((list param))
quy=*quay
|= $: pax/path
ban/(list param)
quy/quay
==
^- {path quay}
%+ into-path-partial:interpolate

View File

@ -16,11 +16,13 @@
^- action:hall
=- (need ((of -) a))
:~ create+(ot nom+so des+so sec+secu ~)
design+(ot nom+so cof+conf ~)
delete+(ot nom+so why+(mu so) ~)
depict+(ot nom+so des+so ~)
filter+(ot nom+so fit+filt ~)
permit+(ot nom+so inv+bo sis+(as (su fed:ag)) ~)
source+(ot nom+so sub+bo srs+(as sorc) ~)
usage+(ot nom+so add+bo tas+(as so) ~)
::
convey+(ar thot)
phrase+(ot aud+audi ses+(ar spec:dejs:hall-json) ~)
@ -46,11 +48,13 @@
%- pairs
?- -.act
$create ~[nom+s+nom.act des+s+des.act sec+s+sec.act]
$design ~[nom+s+nom.act cof+(conf cof.act)]
$delete ~[nom+s+nom.act why+(mabe why.act cord:enjs)]
$depict ~[nom+s+nom.act des+s+des.act]
$filter ~[nom+s+nom.act fit+(filt fit.act)]
$permit ~[nom+s+nom.act inv+b+inv.act sis+(sa sis.act ship)]
$source ~[nom+s+nom.act sub+b+sub.act srs+(sa srs.act sorc)]
$usage ~[nom+s+nom.act add+b+add.act tas+(sa tas.act cord:enjs)]
::
$phrase ~[aud+(audi aud.act) ses+a+(turn ses.act spec:enjs)]
::

View File

@ -3,6 +3,8 @@
:::: /hoon/run/ren
::
/? 310
/% /!noun/
/, /ren/run /~ ~|(%loop !!)
/ /% /!noun/
==
~& run+-.-
~

View File

@ -16,6 +16,7 @@
::TODO rename
++ name term :< circle name
++ nick cord :< local nickname
++ tags (set knot) :< usage tags
::
:> #
:> # %query-models
@ -110,6 +111,7 @@
$% {$full cof/config} :< set w/o side-effects
{$source add/? src/source} :< add/rem sources
{$caption cap/cord} :< changed description
{$usage add/? tas/tags} :< add/rem usage tags
{$filter fit/filter} :< changed filter
{$secure sec/security} :< changed security
{$permit add/? sis/(set ship)} :< add/rem to b/w-list
@ -136,11 +138,13 @@
++ action :> user action
$% :: circle configuration ::
{$create nom/name des/cord sec/security} :< create circle
{$design nom/name cof/config} :< create with config
{$delete nom/name why/(unit cord)} :< delete + announce
{$depict nom/name des/cord} :< change description
{$filter nom/name fit/filter} :< change message rules
{$permit nom/name inv/? sis/(set ship)} :< invite/banish
{$source nom/name sub/? srs/(set source)} :< un/sub to/from src
{$usage nom/name add/? tas/tags} :< add/rem usage tags
:: messaging ::
{$convey tos/(list thought)} :< post exact
{$phrase aud/audience ses/(list speech)} :< post easy
@ -178,6 +182,7 @@
++ config :> circle config
$: src/(set source) :< active sources
cap/cord :< description
tag/tags :< usage tags
fit/filter :< message rules
con/control :< restrictions
== ::

View File

@ -319,6 +319,13 @@
:>
p=item
::
+* lest [item]
:> null-terminated non-empty list
:>
:> mold generator: produces a mold of a null-terminated list of the
:> homogeneous type {a} with at least one element.
[i/item t/(list item)]
::
++ mold
:> normalizing gate
:>
@ -326,7 +333,7 @@
:> input if it fits or a default value if it doesn't.
:>
:> examples: * @ud ,[p=time q=?(%a %b)]
_|=(* +<)
_|~(* +<)
::
+* pair [head tail]
:> dual tuple
@ -528,7 +535,7 @@
(b u.a)
::
++ bind :: argue
|* {a/(unit) b/$-(* *)}
|* {a/(unit) b/gate}
?~ a ~
[~ u=(b u.a)]
::
@ -778,23 +785,30 @@
^+ t.a
[i.a $(a (skim t.a |:(c=i.a !(b c i.a))))]
::
++ spin
|* {a/(list) b/_=>(~ |=({* *} [** +<+])) c/*}
:: ?< ?=($-([_?<(?=(~ a) i.a) _c] [* _c]) b)
|-
++ spin :> stateful turn
:>
:> a: list
:> b: state
:> c: gate from list-item and state to product and new state
~/ %spin
|* [a=(list) b=* c=_|=(^ [** +<+])]
=> .(c `$-([_?>(?=(^ a) i.a) _b] [* _b])`c)
=/ acc=(list _-:(c)) ~
:> transformed list and updated state
|- ^- (pair _acc _b)
?~ a
~
=+ v=(b i.a c)
[i=-.v t=$(a t.a, c +.v)]
[(flop acc) b]
=^ res b (c i.a b)
$(acc [res acc], a t.a)
::
++ spun
|* {a/(list) b/_=>(~ |=({* *} [** +<+]))}
=| c/_+<+.b
|-
?~ a
~
=+ v=(b i.a c)
[i=-.v t=$(a t.a, c +.v)]
++ spun :> internal spin
:>
:> a: list
:> b: gate from list-item and state to product and new state
~/ %spun
|* [a=(list) b=_|=(^ [** +<+])]
:> transformed list
p:(spin a +<+.b b)
::
++ swag :: slice
|* {{a/@ b/@} c/(list)}
@ -802,7 +816,7 @@
::
++ turn :: transform
~/ %turn
|* {a/(list) b/$-(* *)}
|* {a/(list) b/gate}
|-
?~ a ~
[i=(b i.a) t=$(a t.a)]
@ -1610,7 +1624,7 @@
$(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
::
+- rib :: transform + product
|* {b/* c/$-(* *)}
|* {b/* c/gate}
|- ^+ [b a]
?~ a [b ~]
=+ d=(c n.a b)
@ -1620,7 +1634,7 @@
[-.f [n.a +.e +.f]]
::
+- run :: apply gate to values
|* b/$-(* *)
|* b/gate
|-
?~ a a
[n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
@ -2274,7 +2288,7 @@
=+ ^= q %+ max
?: (gth m prc) (^sub m prc) 0 :: reduce precision
%- abs:si ?: =(den %i) --0 :: enforce min. exp
?: =((cmp:si e.a emn) -1) (dif:si emn e.a) --0
?: =((cmp:si e.a emn) -1) (dif:si emn e.a) --0
=^ b a :- (end 0 q a.a)
a(e (sum:si e.a (sun:si q)), a (rsh 0 q a.a))
::
@ -4165,8 +4179,42 @@
(weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
==
::
++ ug :: horrible hack
|%
++ ace :: strip ctrl chars
|= a=tape
^- tape
?~ a ~
?: |((lth i.a 32) =(127 `@`i.a))
$(a t.a)
[i.a $(a t.a)]
::
++ act :: pretend tapes
|= tac=tank
^- tank
?- -.tac
%leaf [%leaf (hew p.tac)]
%palm :+ %palm
[(hew p.p.tac) (hew q.p.tac) (hew r.p.tac) (hew s.p.tac)]
(turn q.tac act)
%rose :+ %rose
[(hew p.p.tac) (hew q.p.tac) (hew r.p.tac)]
(turn q.tac act)
==
::
++ fix :: restore tapes
|= wol=wall
%+ turn wol
|=(a=tape (tufa `(list @c)``(list @)`a))
::
++ hew :: pretend tape
|=(a=tape `tape``(list @)`(tuba (ace a)))
--
::
++ win
|= {tab/@ edg/@}
=. tac (act:ug tac)
%- fix:ug
=+ lug=`wall`~
|^ |- ^- wall
?- -.tac
@ -4476,7 +4524,7 @@
::
++ cook :: apply gate
~/ %cook
|* {poq/$-(* *) sef/rule}
|* {poq/gate sef/rule}
~/ %fun
|= tub/nail
=+ vex=(sef tub)
@ -10166,7 +10214,7 @@
{$cell *} |
{$core *} dext(ref repo(sut ref))
{$face *} dext(ref q.ref)
{$fork *} (levy ~(tap in p.ref) |=(type sint(ref +<)))
{$fork *} (levy ~(tap in p.ref) |=(type dext(ref +<)))
{$hint *} dext(ref q.ref)
{$hold *} ?: (~(has in reg) ref) &
?: (~(has in gil) [sut ref]) &
@ -10515,9 +10563,8 @@
=> .(fan (~(gas in fan) leg))
%- fork
%~ tap in
%- ~(gas in *(set type))
(turn leg |=({p/type q/hoon} (play(sut p) q)))
==
%- ~(gas in *(set type))
(turn leg |=({p/type q/hoon} (play(sut p) q)))
::
++ take
|= {vit/vein duz/$-(type type)}
@ -10622,14 +10669,20 @@
--
|_ sut/type
++ dash
|= {mil/tape lim/char} ^- tape
:- lim
|- ^- tape
?~ mil [lim ~]
?: =(lim i.mil) ['\\' i.mil $(mil t.mil)]
?: =('\\' i.mil) ['\\' i.mil $(mil t.mil)]
?: (lte ' ' i.mil) [i.mil $(mil t.mil)]
['\\' ~(x ne (rsh 2 1 i.mil)) ~(x ne (end 2 1 i.mil)) $(mil t.mil)]
|= {mil/tape lim/char lam/tape}
^- tape
=/ esc (~(gas in *(set @tD)) lam)
:- lim
|- ^- tape
?~ mil [lim ~]
?: ?| =(lim i.mil)
=('\\' i.mil)
(~(has in esc) i.mil)
==
['\\' i.mil $(mil t.mil)]
?: (lte ' ' i.mil)
[i.mil $(mil t.mil)]
['\\' ~(x ne (rsh 2 1 i.mil)) ~(x ne (end 2 1 i.mil)) $(mil t.mil)]
::
++ deal |=(lum/* (dish dole lum))
++ dial
@ -10761,7 +10814,7 @@
[(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)]
::
$yarn
[~ %leaf (dash (tape lum) '"')]
[~ %leaf (dash (tape lum) '"' "\{")]
::
$void
~
@ -10774,7 +10827,7 @@
?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig)))
~(rend co [%$ p.q.ham lum])
$$ ~(rend co [%$ %ud lum])
$t (dash (rip 3 lum) '\'')
$t (dash (rip 3 lum) '\'' ~)
$tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])]
==
::
@ -10980,10 +11033,9 @@
:_ p.doy
%^ cat 3
%~ rent co
:+ %$ %ud
%- ~(rep by (~(run by q.s.q.sut) |=(tomb ~(wyt by q))))
|=([[@ a=@u] b=@u] (add a b))
==
:+ %$ %ud
%- ~(rep by (~(run by q.s.q.sut) |=(tomb ~(wyt by q))))
|=([[@ a=@u] b=@u] (add a b))
%^ cat 3
?-(p.q.sut $gold '.', $iron '|', $lead '?', $zinc '&')
=+ gum=(mug q.s.q.sut)
@ -13069,7 +13121,6 @@
++ expr |.(;~(gunk loaf wisp)) :: hoon and core tail
++ exps |.((butt hank)) :: closed gapped hoons
++ expt |.(;~(gunk wise rope loaf loaf)) :: =^
++ expu |.(;~(gunk rope loaf (butt hank))) :: wing, hoon, hoons
++ expv |.((butt rick)) :: just changes
++ expw |.(;~(gunk rope loaf loaf loaf)) :: wing and three hoons
++ expx |. ;~ gunk loaf :: hoon and core tail
@ -13488,7 +13539,7 @@
== ::
++ desk @tas :: ship desk case spur
++ cage (cask vase) :: global metadata
++ cask |*(a/$-(* *) (pair mark a)) :: global data
++ cask |*(a/mold (pair mark a)) :: global data
++ cuff :: permissions
$: p/(unit (set monk)) :: can be read by
q/(set monk) :: caused or created by
@ -13496,8 +13547,8 @@
++ curd {p/@tas q/*} :: typeless card
++ dock (pair @p term) :: message target
++ duct (list wire) :: causal history
++ hypo |*(a/$-(* *) (pair type a)) :: type associated
++ hobo |* a/$-(* *) :: task wrapper
++ hypo |*(a/mold (pair type a)) :: type associated
++ hobo |* a/gate :: task wrapper
$? $% {$soft p/*} ::
== ::
a ::
@ -13548,7 +13599,7 @@
mev/type :: -:!>([%meta *vase])
== ::
++ wind :: new kernel action
|* {a/$-(* *) b/$-(* *)} :: forward+reverse
|* {a/gate b/gate} :: forward+reverse
$% {$pass p/path q/a} :: advance
{$slip p/a} :: lateral
{$give p/b} :: retreat

View File

@ -1,9 +1,10 @@
:: :: ames (4a), networking
:: :: ames (4a), networking
::
|= pit=vase
=> =~
:: structures
=, ames
=+ protocol-version=0
|%
+= move [p=duct q=(wind note:able gift:able)] :: local move
--
@ -160,7 +161,7 @@
0w0 :: 42, ~tul, Curtis Yarvin
0w0 :: 43, ~met, Curtis Yarvin
0w0 :: 44, ~wen, Curtis Yarvin
0w0 :: 45, ~byn, Curtis Yarvin
0w0 :: 45, ~byn, Curtis Yarvin
0w0 :: 46, ~hex, James Torre
0w0 :: 47, ~feb, urbit.org
0wK.GoKEY.rMjfn.ZcvFQ.n4BmX :: 48, ~pyl, Michael Hartl (oldkey)
@ -172,7 +173,7 @@
0w0 :: 54, ~wyd, Curtis Yarvin
0w0 :: 55, ~tep, Curtis Yarvin
0w0 :: 56, ~bes, Curtis Yarvin
0w0 :: 57, ~dex, Jared Hance
0w0 :: 57, ~dex, Jared Hance
0w0 :: 58, ~sef, Owen Rescher
0w0 :: 59, ~wyc, Galen Wolfe-Pauly
0w0 :: 60, ~bur, Galen Wolfe-Pauly
@ -260,7 +261,7 @@
0w0 :: 142, ~ted, urbit.org
0w2d.GLlYg.-MwtO.ZCPBE.OqGB9 :: 143, ~rus, Stephen Burnham (oldkey)
0w0 :: 144, ~bex, urbit.org
0w0 :: 145, ~leb, Justin LeBlanc
0w1M.E6dLP.eXY5V.Mh5TT.-u9KN :: 145, ~leb, Justin LeBlanc
0w0 :: 146, ~dux, urbit.org
0w0 :: 147, ~ryn, urbit.org
0w0 :: 148, ~num, Tlon
@ -362,7 +363,7 @@
0w0 :: 244, ~byr, Tlon
0w0 :: 245, ~sen, Tlon
0w0 :: 246, ~weg, Tlon
0w28.bRVMq.Oi3tM.zOCNV.j00Yq :: 247, ~fyr, Anton Dyudin (oldkey)
0w3j.imkco.mBXNt.xFbvS.ohabN :: 247, ~fyr, Anton Dyudin
0w0 :: 248, ~mur, Tlon
0w0 :: 249, ~tel, Tlon
0w3w.V54nF.e9eNv.1fLkl.PiUo- :: 250, ~rep, Raymond Pasco
@ -386,7 +387,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(7 vez)
?> =(protocol-version vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -406,7 +407,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 7]
:~ [3 protocol-version]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -976,10 +977,10 @@
|= [our=ship ger=@uw fak=?] :: instantiate emperor
^- [p=(list boon) q=fort]
=+ ^= loy
?: fak
?: fak
:: fake uses carrier number as seed
::
(pit:nu:crub:crypto 512 our)
(pit:nu:crub:crypto 512 our)
(pit:nu:crub:crypto 512 ger)
=+ fim==(fig:ex:loy (zeno our))
?: &(!fak !fim) !! :: not fake & bad fig
@ -996,7 +997,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(7 (end 0 3 pac)) [~ fox]
?. =(protocol-version (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)
@ -1115,7 +1116,7 @@
:: it now, since it obviously won't be processed.
::
~& [%fail-ack did.rum]
=^ gud +>.$
=^ gud +>.$
(cook ``[%dead-message ~] cha `[q.u.cun r.u.cun])
?. gud +>.$
%= +>.$
@ -1276,15 +1277,15 @@
:: or negative ack if this ship is blocked
::
=* cop ^- coop
%+ fall
(~(get by bum.rum) num)
%+ fall
(~(get by bum.rum) num)
?:(bad ~ ``[%blocked ~])
con:(cook (~(get by bum.rum) num) cha `[ryn dam])
::
:: insert this message in unprocessed set
::
=. mis.rum (~(put by mis.rum) num [kay ryn dam dut])
::
::
:: if ship is blocked, advance pointer to latest message
::
=. did.rum ?.(bad did.rum num)
@ -1553,7 +1554,7 @@
(hunt lth doz rtn.sop.bah)
::
++ load
|= old=fort
|= old=fort
~& %ames-reload
..^$(fox old)
::
@ -1614,7 +1615,7 @@
:_ fox [hen %pass pax i.q.q.bon %west p.bon t.q.q.bon r.bon]~
::
%ouzo
:: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))]
:: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))]
:_ fox
[[gad.fox [%give %send p.bon q.bon]] ~]
::
@ -1684,7 +1685,7 @@
?: ?=(%wegh -.kyz)
~& %ames-weighing
[[hen %give %mass wegh]~ +>]
=+ ^= fuy
=+ ^= fuy
^- [p=(list boon) q=fort]
?- -.kyz
%barn

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
-- ::
=> |% :: console protocol
++ axle ::
$: $3 ::
$: $0 ::
ore/(unit ship) :: identity once set
hey/(unit duct) :: default duct
dug/(map duct axon) :: conversations
@ -45,7 +45,11 @@
++ note-clay ::
$% {$merg p/@p q/@tas r/@p s/@tas t/case u/germ:clay}:: merge desks
{$warp p/sock q/riff:clay} :: wait for clay hack
<<<<<<< HEAD
{$wegh $~} ::
=======
{$perm p/ship q/desk r/path s/rite:clay} :: change permissions
>>>>>>> master
== ::
++ note-dill :: note to self, odd
$% {$crud p/@tas q/(list tank)} ::
@ -90,7 +94,11 @@
$% {$mere p/(each (set path) (pair term tang))} ::
{$note p/@tD q/tank} ::
{$writ p/riot:clay} ::
<<<<<<< HEAD
{$mass p/mass} ::
=======
{$mack p/(unit tang)} ::
>>>>>>> master
== ::
++ sign-dill ::
$% {$blit p/(list blit)} ::
@ -301,7 +309,8 @@
(sync %home our %base)
(init-sync %home our %base)
=. +> ?. ?=(?($duke $king $czar) can) +>
(sync %kids our %base)
:: make kids desk publicly readable, so syncs work.
(show %kids):(sync %kids our %base)
=. +> autoload
=. +> peer
|- ^+ +>+
@ -337,6 +346,16 @@
:_(moz [hen %pass ~ %g %deal [our our] ram %peer /drum])
==
::
++ show :: permit reads on desk
|= des/desk
%_ +>.$
moz
:_ moz
:* hen %pass /show %c %perm our
des / r+`[%black ~]
==
==
::
++ sync
|= syn/{desk ship desk}
%_ +>.$
@ -417,6 +436,10 @@
::
{$c $writ *}
init
::
{$c $mack *}
?~ p.sih +>.$
(mean >%dill-clay-nack< u.p.sih)
::
{$d $blit *}
(done +.sih)
@ -465,13 +488,13 @@
%- some
%. q.kyz
%~ into as
:- [~ hen u.ore.all]
:* p.kyz
[~ ~]
80
0
(tuba "<awaiting {(trip p.kyz)}, this may take a few minutes>")
== ==
:- [~ hen u.ore.all]
:* p.kyz
[~ ~]
80
0
(tuba "<awaiting {(trip p.kyz)}, this may take a few minutes>")
==
--
|% :: poke+peek pattern
++ call :: handle request

View File

@ -84,7 +84,7 @@
-- ::
|% :: models
++ bolo :: eyre state
$: $6 :: version
$: $0 :: version
gub/@t :: random identity
hov/(unit ship) :: master for remote
top/beam :: ford serve prefix
@ -756,7 +756,7 @@
(give-thou q.u.mez)
::
$lon
~& ses-ask+[p.u.mez sop (~(run by wup) ,~)]
:: ~& ses-ask+[p.u.mez sop (~(run by wup) ,~)]
?: (ses-authed p.u.mez)
(ames-gram q.p.kyz aut+~ p.u.mez)
=. sop (~(put by sop) p.u.mez q.p.kyz |)

View File

@ -32,9 +32,9 @@
== == == ::
-- ::
|% :: structures
+= axle :: all %ford state
$: %3 :: version for update
pol=(map ship baby) ::
++ axle :: all %ford state
$: $0 :: version for update
pol/(map ship baby) ::
== ::
+= baby :: state by ship
$: tad=[p=@ud q=(map @ud task)] :: tasks by number
@ -1948,9 +1948,9 @@
|= {cof/cafe dir/knot}
=+ nod=(chap(s.how [dir s.how]) cof bax hon)
?: ?=($2 -.q.nod)
(new:bo cof ~)
(tug:bo nod (with:bo some))
%- with:bo
(flue p.nod)
(cope nod (flux some))
%- flux
|= doy/(map @ cage) ^- vase
?~ doy [[%atom %n `0] 0]
%+ slop
@ -2291,7 +2291,7 @@
?~(buy *baby u.buy)
=^ mos bay
?- -.kis
$wipe ~&(%ford-cache-wiped [~ bay(jav ~)])
$wipe ~&(ford-cache-wiped/at=now [~ bay(jav ~)])
$wasp
(~(wasp za [our hen [now eny ski] ~] bay) q.kis)
$exec

View File

@ -32,7 +32,7 @@
|% :::::::::::::::::::::::::::::::::::::::::::::::::::::: %gall state
::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ axle :: all state
$: $4 :: state version
$: $0 :: state version
pol/(map ship mast) :: apps by ship
== ::
++ gest :: subscriber data
@ -1206,6 +1206,9 @@
~
$cash `%a
$conf `%g
$cred `%c
$crew `%c
$crow `%c
$deal `%g
$exec `%f
$flog `%d
@ -1215,6 +1218,7 @@
$mont `%c
$nuke `%a
$ogre `%c
$perm `%c
$serv `%e
$them `%e
$wait `%b

View File

@ -339,7 +339,9 @@
++ able ^?
|%
++ gift :: out result <-$
$% {$dirk p/@tas} :: mark mount dirty
$% {$croz rus/(map desk {r/regs w/regs})} :: rules for group
{$cruz cez/(map @ta crew)} :: permission groups
{$dirk p/@tas} :: mark mount dirty
{$ergo p/@tas q/mode} :: version update
{$hill p/(list @tas)} :: mount points
{$mack p/(unit tang)} :: ack
@ -347,24 +349,34 @@
{$mere p/(each (set path) (pair term tang))} :: merge result
{$note p/@tD q/tank} :: debug message
{$ogre p/@tas} :: delete mount point
{$rule red/dict wit/dict} :: node r+w permissions
{$send p/lane:ames q/@} :: transmit packet
{$writ p/riot} :: response
{$wris p/case p/(set (pair care path))} :: many changes
== ::
++ task :: in request ->$
$% {$boat $~} :: pier rebooted
{$drop p/@p q/desk} :: cancel pending merge
{$info p/@p q/desk r/nori} :: internal edit
{$init p/@p} :: report install
{$into p/desk q/? r/mode} :: external edit
{$merg p/@p q/desk r/@p s/desk t/case u/germ} :: merge desks
{$mont p/desk q/beam} :: mount to unix
{$dirk p/desk} :: mark mount dirty
{$ogre p/$@(desk beam)} :: delete mount point
{$warp p/sock q/riff} :: file request
{$cred our/ship nom/@ta cew/crew} :: set permission group
{$crew our/ship} :: permission groups
{$crow our/ship nom/@ta} :: group usage
{$drop our/@p des/desk} :: cancel pending merge
{$info our/@p des/desk dit/nori} :: internal edit
{$init our/@p} :: report install
{$into des/desk all/? fis/mode} :: external edit
$: $merg :: merge desks
our/@p des/desk :: target
her/@p dem/desk cas/case :: source
how/germ :: method
== ::
{$mont des/desk bem/beam} :: mount to unix
{$dirk des/desk} :: mark mount dirty
{$ogre pot/$@(desk beam)} :: delete mount point
{$perm our/ship des/desk pax/path rit/rite} :: change permissions
{$warp wer/sock rif/riff} :: internal file req
{$werp who/ship wer/sock rif/riff} :: external file req
{$wegh $~} :: report memory
{$went p/sack q/path r/@ud s/coop} :: response confirm
{$west p/sack q/path r/*} :: network request
{$went wer/sack pax/path num/@ud ack/coop} :: response confirm
{$west wer/sack pax/path res/*} :: network request
== ::
-- ::able
::
@ -382,13 +394,15 @@
$% {$delta p/lobe q/{p/mark q/lobe} r/page} :: delta on q
{$direct p/lobe q/page} :: immediate
== ::
++ care ?($d $u $v $w $x $y $z) :: clay submode
++ care ?($d $p $u $v $w $x $y $z) :: clay submode
++ case :: ship desk case spur
$% {$da p/@da} :: date
{$tas p/@tas} :: label
{$ud p/@ud} :: number
== ::
++ coop (unit ares) :: e2e ack
++ crew (set ship) :: permissions group
++ dict {src/path rul/rule} :: effective permission
++ dome :: project state
$: ank/ankh :: state
let/@ud :: top id
@ -453,8 +467,15 @@
{$mult p/mool} :: next version of any
{$many p/? q/moat} :: track range
== ::
++ regs (map path rule) :: rules for paths
++ riff {p/desk q/(unit rave)} :: request+desist
++ rite :: new permissions
$% {$r red/(unit rule)} :: for read
{$w wit/(unit rule)} :: for write
{$rw red/(unit rule) wit/(unit rule)} :: for read and write
== ::
++ riot (unit rant) :: response+complete
++ rule {mod/?($black $white) who/(set whom)} :: node permission
++ rump {p/care q/case r/@tas s/path} :: relative path
++ saba {p/ship q/@tas r/moar s/dome} :: patch+merge
++ soba (list {p/path q/miso}) :: delta
@ -467,6 +488,7 @@
{%| p/(list a) q/(list a)} :: p -> q[chunk]
== ::
++ urge |*(a/mold (list (unce a))) :: list change
++ whom (each ship @ta) :: ship or named crew
++ yaki :: commit
$: p/(list tako) :: parents
q/(map path lobe) :: namespace
@ -2895,6 +2917,315 @@
:: alice decrypts with same key
`@t`(dy.ali secret-key crypted-msg)
-- ::test
:: ::
:::: ++keccak:crypto :: (2b7) keccak family
:: ::::
++ keccak
|%
::
:: keccak
::
++ keccak-224 |=(a=octs (keccak 1.152 448 224 a))
++ keccak-256 |=(a=octs (keccak 1.088 512 256 a))
++ keccak-384 |=(a=octs (keccak 832 768 384 a))
++ keccak-512 |=(a=octs (keccak 576 1.024 512 a))
::
++ keccak (cury (cury hash keccak-f) padding-keccak)
::
++ padding-keccak (multirate-padding 0x1)
::
:: sha3
::
++ sha3-224 |=(a=octs (sha3 1.152 448 224 a))
++ sha3-256 |=(a=octs (sha3 1.088 512 256 a))
++ sha3-384 |=(a=octs (sha3 832 768 384 a))
++ sha3-512 |=(a=octs (sha3 576 1.024 512 a))
::
++ sha3 (cury (cury hash keccak-f) padding-sha3)
::
++ padding-sha3 (multirate-padding 0x6)
::
:: shake
::
++ shake-128 |=([o=@ud i=octs] (shake 1.344 256 o i))
++ shake-256 |=([o=@ud i=octs] (shake 1.088 512 o i))
::
++ shake (cury (cury hash keccak-f) padding-shake)
::
++ padding-shake (multirate-padding 0x1f)
::
:: rawshake
::
++ rawshake-128 |=([o=@ud i=octs] (rawshake 1.344 256 o i))
++ rawshake-256 |=([o=@ud i=octs] (rawshake 1.088 512 o i))
::
++ rawshake (cury (cury hash keccak-f) padding-rawshake)
::
++ padding-rawshake (multirate-padding 0x7)
::
:: core
::
++ hash
:> per: permutation function with configurable width.
:> pad: padding function.
:> rat: bitrate, size in bits of blocks to operate on.
:> cap: capacity, bits of sponge padding.
:> out: length of desired output, in bits.
:> inp: input to hash.
|= $: per=$-(@ud $-(@ @))
pad=$-([octs @ud] octs)
rat=@ud
cap=@ud
out=@ud
inp=octs
==
^- @
:: urbit's little-endian to keccak's big-endian.
=. q.inp
=+ (swp 3 q.inp)
(lsh 3 (sub p.inp (met 3 q.inp)) -)
%. [inp out]
(sponge per pad rat cap)
::
::NOTE if ++keccak ever needs to be made to operate
:: on bits rather than bytes, all that needs to
:: be done is updating the way this padding
:: function works. (and also "octs" -> "bits")
++ multirate-padding
:> dsb: domain separation byte, reverse bit order.
|= dsb=@ux
?> (lte dsb 0xff)
|= [inp=octs mut=@ud]
^- octs
=. mut (div mut 8)
=+ pal=(sub mut (mod p.inp mut))
=? pal =(pal 0) mut
=. pal (dec pal)
:- (add p.inp +(pal))
:: padding is provided in lane bit ordering,
:: ie, LSB = left.
(cat 3 (con (lsh 3 pal dsb) 0x80) q.inp)
::
++ sponge
:> sponge construction
::
:> preperm: permutation function with configurable width.
:> padding: padding function.
:> bitrate: size of blocks to operate on.
:> capacity: sponge padding.
|= $: preperm=$-(@ud $-(@ @))
padding=$-([octs @ud] octs)
bitrate=@ud
capacity=@ud
==
::
:: preparing
=+ bitrate-bytes=(div bitrate 8)
=+ blockwidth=(add bitrate capacity)
=+ permute=(preperm blockwidth)
::
|= [input=octs output=@ud]
|^ ^- @
::
:: padding
=. input (padding input bitrate)
::
:: absorbing
=/ pieces=(list @)
:: amount of bitrate-sized blocks.
?> =(0 (mod p.input bitrate-bytes))
=+ i=(div p.input bitrate-bytes)
|-
?: =(i 0) ~
:_ $(i (dec i))
:: get the bitrate-sized block of bytes
:: that ends with the byte at -.
=- (cut 3 [- bitrate-bytes] q.input)
(mul (dec i) bitrate-bytes)
=/ state=@
:: for every piece,
%+ roll pieces
|= [p=@ s=@]
:: pad with capacity,
=. p (lsh 0 capacity p)
:: xor it into the state and permute it.
(permute (mix s (bytes-to-lanes p)))
::
:: squeezing
=| res=@
=| len=@ud
|-
:: append a bitrate-sized head of state to the
:: result.
=. res
%+ con (lsh 0 bitrate res)
(rsh 0 capacity (lanes-to-bytes state))
=. len (add len bitrate)
?: (gte len output)
:: produce the requested bits of output.
(rsh 0 (sub len output) res)
$(res res, state (permute state))
::
++ bytes-to-lanes
:> flip byte order in blocks of 8 bytes.
|= a=@
%+ can 6
%+ turn (rip 6 a)
|= b=@
:- 1
(lsh 3 (sub 8 (met 3 b)) (swp 3 b))
::
++ lanes-to-bytes
:> unflip byte order in blocks of 8 bytes.
|= a=@
%+ can 6
%+ turn
=+ (rip 6 a)
(weld - (reap (sub 25 (lent -)) 0x0))
|= a=@
:- 1
%+ can 3
=- (turn - |=(a=@ [1 a]))
=+ (flop (rip 3 a))
(weld (reap (sub 8 (lent -)) 0x0) -)
--
::
++ keccak-f
:> keccak permutation function
|= [width=@ud]
:: assert valid blockwidth.
?> =- (~(has in -) width)
(sy 25 50 100 200 400 800 1.600 ~)
:: assumes 5x5 lanes state, as is the keccak
:: standard.
=+ size=5
=+ lanes=(mul size size)
=+ lane-bloq=(dec (xeb (div width lanes)))
=+ lane-size=(bex lane-bloq)
=+ rounds=(add 12 (mul 2 lane-bloq))
|= [input=@]
^- @
=* a input
=+ round=0
|^
?: =(round rounds) a
::
:: theta
=/ c=@
%+ roll (gulf 0 (dec size))
|= [x=@ud c=@]
%+ con (lsh lane-bloq 1 c)
%+ roll (gulf 0 (dec size))
|= [y=@ud c=@]
(mix c (get-lane x y a))
=/ d=@
%+ roll (gulf 0 (dec size))
|= [x=@ud d=@]
%+ con (lsh lane-bloq 1 d)
%+ mix
=- (get-word - size c)
?:(=(x 0) (dec size) (dec x))
%^ ~(rol fe lane-bloq) 0 1
(get-word (mod +(x) size) size c)
=. a
%+ roll (gulf 0 (dec lanes))
|= [i=@ud a=_a]
%+ mix a
%^ lsh lane-bloq
(sub lanes +(i))
(get-word i size d)
::
:: rho and pi
=/ b=@
%+ roll (gulf 0 (dec lanes))
|= [i=@ b=@]
=+ x=(mod i 5)
=+ y=(div i 5)
%+ con b
%^ lsh lane-bloq
%+ sub lanes
%+ add +(y)
%+ mul size
(mod (add (mul 2 x) (mul 3 y)) size)
%^ ~(rol fe lane-bloq) 0
(rotation-offset i)
(get-word i lanes a)
::
:: chi
=. a
%+ roll (gulf 0 (dec lanes))
|= [i=@ud a=@]
%+ con (lsh lane-bloq 1 a)
=+ x=(mod i 5)
=+ y=(div i 5)
%+ mix (get-lane x y b)
%+ dis
=- (get-lane - y b)
(mod (add x 2) size)
%^ not lane-bloq 1
(get-lane (mod +(x) size) y b)
::
:: iota
=. a
=+ (round-constant round)
(mix a (lsh lane-bloq (dec lanes) -))
::
:: next round
$(round +(round))
::
++ get-lane
:> get the lane with coordinates
|= [x=@ud y=@ud a=@]
=+ i=(add x (mul size y))
(get-word i lanes a)
::
++ get-word
:> get word {n} from atom {a} of {m} words.
|= [n=@ud m=@ud a=@]
(cut lane-bloq [(sub m +((mod n m))) 1] a)
::
++ round-constant
|= c=@ud
=- (snag (mod c 24) -)
^- (list @ux)
:~ 0x1
0x8082
0x8000.0000.0000.808a
0x8000.0000.8000.8000
0x808b
0x8000.0001
0x8000.0000.8000.8081
0x8000.0000.0000.8009
0x8a
0x88
0x8000.8009
0x8000.000a
0x8000.808b
0x8000.0000.0000.008b
0x8000.0000.0000.8089
0x8000.0000.0000.8003
0x8000.0000.0000.8002
0x8000.0000.0000.0080
0x800a
0x8000.0000.8000.000a
0x8000.0000.8000.8081
0x8000.0000.0000.8080
0x8000.0001
0x8000.0000.8000.8008
==
::
++ rotation-offset
|= x=@ud
=- (snag x -)
^- (list @ud)
:~ 0 1 62 28 27
36 44 6 55 20
3 10 43 25 39
41 45 15 21 8
18 2 61 56 14
==
--
-- ::keccak
-- ::crypto
:: ::::
:::: ++unity :: (2c) unit promotion
@ -3803,10 +4134,10 @@
:: :: ++clot:en-xml:html
++ clot ~+ :: self-closing tags
%~ has in
%- silt ^- (list term) :~
%area %base %br %col %command %embed %hr %img %inputt
%keygen %link %meta %param %source %track %wbr
== ==
%- silt ^- (list term) :~
%area %base %br %col %command %embed %hr %img %inputt
%keygen %link %meta %param %source %track %wbr
==
-- ::en-xml
:: :: ++de-xml:html
++ de-xml :: xml parser

View File

@ -1,280 +1,242 @@
/+ new-hoon, tester
=, ls:new-hoon
|_ tester-type:tester
|_ _tester:tester
++ test-head
(expect-eq (head [1 ~]) 1 "head")
(expect-eq !>([1 (head [1 ~])]))
::
++ test-last
(expect-eq (last:ls [1 2 ~]) 2 "last")
(expect-eq !>([2 (last:ls [1 2 ~])]))
::
++ test-tail
(expect-eq (tail [1 2 3 ~]) [2 3 ~] "tail")
(expect-eq !>([[2 3 ~] (tail [1 2 3 ~])]))
::
++ test-init
(expect-eq (init [1 2 3 ~]) [1 2 ~] "init")
(expect-eq !>([[1 2 ~] (init [1 2 3 ~])]))
::
++ test-size
(expect-eq (size ['a' 'b' 'c' ~]) 3 "size")
(expect-eq !>([3 (size ['a' 'b' 'c' ~])]))
::
++ test-map
(expect-eq (map:ls [1 2 ~] |=(a/@ (add 1 a))) [2 3 ~] "map")
(expect-eq !>([[2 3 ~] (map:ls [1 2 ~] |=(a/@ (add 1 a)))]))
::
++ test-reverse
(expect-eq (reverse [1 2 3 ~]) [3 2 1 ~] "reverse")
(expect-eq !>([[3 2 1 ~] (reverse [1 2 3 ~])]))
::
++ test-intersperse
(expect-eq (intersperse 1 [5 5 5 ~]) [5 1 5 1 5 ~] "intersperse")
(expect-eq !>([[5 1 5 1 5 ~] (intersperse 1 [5 5 5 ~])]))
::
++ test-intercalate
%^ expect-eq
%- expect-eq !>
:- ["one,two,three"]
(intercalate "," ["one" "two" "three" ~])
["one,two,three"]
"intercalate"
::
++ test-transpose
%^ expect-eq
%- expect-eq !>
:- ~[~[1 4] ~[2 5] ~[3 6]]
(transpose ~[~[1 2 3] ~[4 5 6]])
~[~[1 4] ~[2 5] ~[3 6]]
"transpose"
::
++ test-foldl
(expect-eq (foldl [1 2 3 ~] 3 |=({a/@ b/@} (add a b))) 9 "foldl")
(expect-eq !>([9 (foldl [1 2 3 ~] 3 |=({a/@ b/@} (add a b)))]))
::
++ test-foldr
(expect-eq (foldr [1 2 3 ~] 1 |=({a/@ b/@} (add a b))) 7 "foldr")
(expect-eq !>([7 (foldr [1 2 3 ~] 1 |=({a/@ b/@} (add a b)))]))
::
++ test-concat
(expect-eq (concat ~[~[1 2] ~[3 4]]) ~[1 2 3 4] "concat")
(expect-eq !>([~[1 2 3 4] (concat ~[~[1 2] ~[3 4]])]))
::
++ test-weld
(expect-eq (weld:ls ~[1 2 3] ~["one" "two"]) ~[1 2 3 "one" "two"] "weld")
(expect-eq !>([~[1 2 3 "one" "two"] (weld:ls ~[1 2 3] ~["one" "two"])]))
::
++ test-any-true
(expect-eq (any [1 2 3 ~] |=(a/@ =(a 2))) %.y "any true")
(expect-eq !>([%.y (any [1 2 3 ~] |=(a/@ =(a 2)))]))
::
++ test-any-false
(expect-eq (any [1 2 3 ~] |=(a/@ =(a 8))) %.n "any false")
(expect-eq !>([%.n (any [1 2 3 ~] |=(a/@ =(a 8)))]))
::
++ test-all-true
(expect-eq (all [1 1 1 ~] |=(a/@ =(a 1))) %.y "all true")
(expect-eq !>([%.y (all [1 1 1 ~] |=(a/@ =(a 1)))]))
::
++ test-all-false
(expect-eq (all [1 3 1 ~] |=(a/@ =(a 1))) %.n "all false")
(expect-eq !>([%.n (all [1 3 1 ~] |=(a/@ =(a 1)))]))
::
++ test-scanl
%^ expect-eq
%- expect-eq !>
:- ~[0 1 3 6]
(scanl ~[1 2 3] 0 |=({a/@ b/@} (add a b)))
~[0 1 3 6]
"scanl"
::
++ test-scanl1
%^ expect-eq
%- expect-eq !>
:- ~[1 3 6]
(scanl1 ~[1 2 3] |=({a/@ b/@} (add a b)))
~[1 3 6]
"scanl1"
::
++ test-scanr
%^ expect-eq
%- expect-eq !>
:- ~[6 5 3 0]
(scanr ~[1 2 3] 0 |=({a/@ b/@} (add a b)))
~[6 5 3 0]
"scanr"
::
++ test-scanr1
%^ expect-eq
%- expect-eq !>
:- ~[6 5 3]
(scanr1 ~[1 2 3] |=({a/@ b/@} (add a b)))
~[6 5 3]
"scanr1"
::
++ test-map-foldl
%^ expect-eq
%- expect-eq !>
:- [7 ~[2 3 5]]
(map-foldl ~[1 2 3] 1 |=({a/@ b/@} [(add a b) (add 1 a)]))
[7 ~[2 3 5]]
"map-foldl"
::
++ test-map-foldr
%^ expect-eq
%- expect-eq !>
:- [7 ~[7 5 2]]
(map-foldr ~[1 2 3] 1 |=({a/@ b/@} [(add a b) (add 1 a)]))
[7 ~[7 5 2]]
"map-foldr"
::
++ test-unfoldr
%^ expect-eq
%- expect-eq !>
:- [5 4 3 2 1 ~]
(unfoldr 5 |=(a/@ ?:(=(a 0) ~ `[a (dec a)])))
[5 4 3 2 1 ~]
"unfoldr"
::
++ test-take
%^ expect-eq
%- expect-eq !>
:- [1 2 3 ~]
(take 3 ~[1 2 3 4 5])
[1 2 3 ~]
"take"
::
++ test-drop
%^ expect-eq
%- expect-eq !>
:- [4 5 ~]
(drop:ls 3 ~[1 2 3 4 5])
[4 5 ~]
"drop"
::
++ test-split-at
%^ expect-eq
%- expect-eq !>
:- [[1 2 3 ~] [4 5 ~]]
(split-at 3 ~[1 2 3 4 5])
[[1 2 3 ~] [4 5 ~]]
"split-at"
::
++ test-take-while
%^ expect-eq
%- expect-eq !>
:- [1 2 ~]
(take-while ~[1 2 3 4 5] |=(a/@ (lth a 3)))
[1 2 ~]
"take-while"
::
++ test-drop-while
%^ expect-eq
%- expect-eq !>
:- [3 4 5 ~]
(drop-while ~[1 2 3 4 5] |=(a/@ (lth a 3)))
[3 4 5 ~]
"drop-while"
::
++ test-drop-while-end
%^ expect-eq
%- expect-eq !>
:- [5 5 1 ~]
(drop-while-end ~[5 5 1 5 5] |=(a/@ =(a 5)))
[5 5 1 ~]
"drop-while-end"
::
++ test-split-on
%^ expect-eq
%- expect-eq !>
:- [[1 2 ~] [3 4 1 2 3 4 ~]]
(split-on ~[1 2 3 4 1 2 3 4] |=(a/@ (lth a 3)))
[[1 2 ~] [3 4 1 2 3 4 ~]]
"split-on"
::
++ test-break
%^ expect-eq
%- expect-eq !>
:- [[1 2 3 ~] [4 1 2 3 4 ~]]
(break ~[1 2 3 4 1 2 3 4] |=(a/@ (gth a 3)))
[[1 2 3 ~] [4 1 2 3 4 ~]]
"break"
::
++ test-strip-prefix
%^ expect-eq
%- expect-eq !>
:- [~ "bar"]
(strip-prefix "foo" "foobar")
[~ "bar"]
"break"
::
++ test-inits
%^ expect-eq
%- expect-eq !>
:- ["a" "ab" "abc" ~]
(inits "abc")
["a" "ab" "abc" ~]
"inits"
::
++ test-tails
%^ expect-eq
%- expect-eq !>
:- ["abc" "bc" "c" ~]
(tails "abc")
["abc" "bc" "c" ~]
"tails"
::
++ test-is-prefix-of
%^ expect-eq
%- expect-eq !>
:- %.y
(is-prefix-of "foo" "foobar")
%.y
"is-prefix-of"
::
++ test-is-suffix-of
%^ expect-eq
%- expect-eq !>
:- %.y
(is-suffix-of "bar" "foobar")
%.y
"is-suffix-of"
::
++ test-is-infix-of
%^ expect-eq
%- expect-eq !>
:- %.y
(is-infix-of "ob" "foobar")
%.y
"is-infix-of"
::
++ test-elem
%^ expect-eq
%- expect-eq !>
:- %.y
(elem 5 [1 2 3 4 5 ~])
%.y
"elem"
::
++ test-lookup
%^ expect-eq
%- expect-eq !>
:- [~ 2]
(lookup "two" [["one" 1] ["two" 2] ["three" 3] ~])
[~ 2]
"lookup"
::
++ test-find
%^ expect-eq
%- expect-eq !>
:- [~ 5]
(find:ls [3 2 1 5 1 2 3 ~] |=(a/@ (gth a 3)))
[~ 5]
"find"
::
++ test-filter
%^ expect-eq
%- expect-eq !>
:- [1 1 1 ~]
(filter [1 2 1 2 1 ~] |=(a/@ =(a 2)))
[1 1 1 ~]
"filter"
::
++ test-partition
%^ expect-eq
%- expect-eq !>
:- [[2 2 ~] [1 1 1 ~]]
(partition [1 2 1 2 1 ~] |=(a/@ =(a 2)))
[[2 2 ~] [1 1 1 ~]]
"partition"
::
++ test-elem-index
%^ expect-eq
%- expect-eq !>
:- `1
(elem-index 2 [1 2 3 4 ~])
`1
"elem-index"
::
++ test-elem-indices
%^ expect-eq
%- expect-eq !>
:- [1 3 ~]
(elem-indices 2 [1 2 1 2 ~])
[1 3 ~]
"elem-indices"
::
++ test-find-index
%^ expect-eq
%- expect-eq !>
:- `1
(find-index [1 2 3 ~] |=(a/@ =(a 2)))
`1
"find-index"
::
++ test-find-indices
%^ expect-eq
%- expect-eq !>
:- [1 3 ~]
(find-indices [1 2 1 2 ~] |=(a/@ =(a 2)))
[1 3 ~]
"find-indices"
::
++ test-zip
%^ expect-eq
%- expect-eq !>
:- [[1 4 7 ~] [2 5 8 ~] [3 6 9 ~] ~]
(zip [[1 2 3 ~] [4 5 6 ~] [7 8 9 ~] ~])
[[1 4 7 ~] [2 5 8 ~] [3 6 9 ~] ~]
"zip"
::
++ test-unique
%^ expect-eq
%- expect-eq !>
:- [1 2 3 ~]
(unique [1 2 3 1 2 3 ~])
[1 2 3 ~]
"unique"
::
++ test-delete
%^ expect-eq
%- expect-eq !>
:- [1 3 2 ~]
(delete 2 [1 2 3 2 ~])
[1 3 2 ~]
"delete"
::
++ test-delete-firsts
%^ expect-eq
%- expect-eq !>
:- [1 2 3 4 ~]
(delete-firsts [1 2 2 2 3 4 5 ~] [2 2 5 ~])
[1 2 3 4 ~]
"delete-firsts"
::
++ test-union
%^ expect-eq
%- expect-eq !>
:- [1 2 3 4 5 ~]
(union [1 2 3 ~] [4 2 5 ~])
[1 2 3 4 5 ~]
"union"
::
++ test-intersect
%^ expect-eq
%- expect-eq !>
:- [6 6 8 ~]
(intersect [5 6 6 7 8 ~] [9 8 8 6 ~])
[6 6 8 ~]
"intersect"
--

View File

@ -2,108 +2,88 @@
=, dct:new-hoon
=+ four=(from-list [[1 "one"] [2 "two"] [3 "three"] [4 "four"] ~])
=+ three=(from-list [[1 "one"] [2 "two"] [3 "three"] ~])
|_ tester-type:tester
|_ _tester:tester
++ test-empty
(expect-eq (empty four) %.n "empty")
(expect-eq !>([%.n (empty four)]))
::
++ test-size
(expect-eq (size four) 4 "size")
(expect-eq !>([4 (size four)]))
::
++ test-member
(expect-eq (member four 4) %.y "member")
(expect-eq !>([%.y (member four 4)]))
::
++ test-put-with
=+ ints=(from-list [["one" 1] ["two" 2] ["three" 3] ["four" 4] ~])
%^ expect-eq
%- expect-eq !>
:- (from-list [["one" 1] ["two" 2] ["three" 5] ["four" 4] ~])
=/ ints (from-list [["one" 1] ["two" 2] ["three" 3] ["four" 4] ~])
(put-with ints "three" 2 add)
(from-list [["one" 1] ["two" 2] ["three" 5] ["four" 4] ~])
"put-with"
::
++ test-put-with-key
%^ expect-eq
%- expect-eq !>
:- (from-list [[1 "one"] [2 "two"] [3 "three"] [4 "4four"] ~])
(put-with-key four 4 "four" |=({a/@ud b/tape c/tape} (weld (scow %ud a) b)))
(from-list [[1 "one"] [2 "two"] [3 "three"] [4 "4four"] ~])
"put-with-key"
::
++ test-put-lookup-with-key
%^ expect-eq
%- put-lookup-with-key :^
four
4
"five"
|=({key/@ud old/tape new/tape} new)
:- `"four"
(from-list [[1 "one"] [2 "two"] [3 "three"] [4 "five"] ~])
"put-lookup-with-key"
%- expect-eq !>
:- [`"four" (from-list [[1 "one"] [2 "two"] [3 "three"] [4 "five"] ~])]
%^ put-lookup-with-key four
4
:- "five"
|=({key/@ud old/tape new/tape} new)
::
++ test-delete
%^ expect-eq
%- expect-eq !>
:- three
(delete four 4)
three
"delete"
::
++ test-adjust
%^ expect-eq
%^ adjust
four
%- expect-eq !>
:- (from-list [[1 "one"] [2 "two"] [3 "thisthree"] [4 "four"] ~])
%^ adjust four
3
|=(a/tape (weld "this" a))
(from-list [[1 "one"] [2 "two"] [3 "thisthree"] [4 "four"] ~])
"adjust"
|=(a/tape (weld "this" a))
::
++ test-adjust-with-key
%^ expect-eq
%^ adjust-with-key
four
%- expect-eq !>
:- (from-list [[1 "one"] [2 "two"] [3 "3three"] [4 "four"] ~])
%^ adjust-with-key four
3
|=({a/@ud b/tape} (weld (scow %ud a) b))
(from-list [[1 "one"] [2 "two"] [3 "3three"] [4 "four"] ~])
"adjust-with-key"
|=({a/@ud b/tape} (weld (scow %ud a) b))
::
++ test-update
%^ expect-eq
%^ update
four
%- expect-eq !>
:- (from-list [[1 "one"] [2 "two"] [4 "four"] ~])
%^ update four
3
|=(a/tape `(maybe tape)`~)
(from-list [[1 "one"] [2 "two"] [4 "four"] ~])
"update"
|=(a/tape `(maybe tape)`~)
::
++ test-update-with-key
%^ expect-eq
%^ update-with-key
four
%- expect-eq !>
:- (from-list [[1 "one"] [2 "two"] [3 "3three"] [4 "four"] ~])
%^ update-with-key four
3
|=({a/@u b/tape} `(maybe tape)`[~ (weld (scow %ud a) b)])
(from-list [[1 "one"] [2 "two"] [3 "3three"] [4 "four"] ~])
"update-with-key"
|=({a/@u b/tape} `(maybe tape)`[~ (weld (scow %ud a) b)])
::
++ test-alter-as-add
%^ expect-eq
%^ alter
four
%- expect-eq !>
:- (from-list [[1 "one"] [2 "two"] [3 "three"] [4 "four"] [5 "five"] ~])
%^ alter four
5
|=(a/(maybe tape) `(maybe tape)`[~ "five"])
(from-list [[1 "one"] [2 "two"] [3 "three"] [4 "four"] [5 "five"] ~])
"alter (as add)"
|=(a/(maybe tape) `(maybe tape)`[~ "five"])
::
++ test-alter-as-delete
%^ expect-eq
%^ alter
four
%- expect-eq !>
:- (from-list [[1 "one"] [3 "three"] [4 "four"] ~])
%^ alter four
2
|=(a/(maybe tape) `(maybe tape)`~)
(from-list [[1 "one"] [3 "three"] [4 "four"] ~])
"alter (as delete)"
|=(a/(maybe tape) `(maybe tape)`~)
::
++ test-alter-as-change
%^ expect-eq
%^ alter
four
%- expect-eq !>
:- (from-list [[1 "one"] [2 "dos"] [3 "three"] [4 "four"] ~])
%^ alter four
2
|=(a/(maybe tape) `(maybe tape)`[~ "dos"])
(from-list [[1 "one"] [2 "dos"] [3 "three"] [4 "four"] ~])
"alter (as change)"
|=(a/(maybe tape) `(maybe tape)`[~ "dos"])
::
++ check-alter
:: check random dicts of 50 items with 40 random operations done on them
@ -133,228 +113,192 @@
$(i +(i))
::
++ test-union
%^ expect-eq
%+ union
%- expect-eq !>
:- (from-list [[1 "left"] [2 "left"] [3 "right"] ~])
%+ union
(from-list [[1 "left"] [2 "left"] ~])
(from-list [[2 "right"] [3 "right"] ~])
(from-list [[1 "left"] [2 "left"] [3 "right"] ~])
"union"
(from-list [[2 "right"] [3 "right"] ~])
::
++ test-union-with
%^ expect-eq
%^ union-with
(from-list [[1 "left"] [2 "left"] ~])
%- expect-eq !>
:- (from-list [[1 "left"] [2 "leftright"] [3 "right"] ~])
%^ union-with
(from-list [[1 "left"] [2 "left"] ~])
(from-list [[2 "right"] [3 "right"] ~])
|=({a/tape b/tape} (weld a b))
(from-list [[1 "left"] [2 "leftright"] [3 "right"] ~])
"union-with"
|=({a/tape b/tape} (weld a b))
::
++ test-union-with-key
%^ expect-eq
%^ union-with-key
(from-list [[1 "left"] [2 "left"] ~])
%- expect-eq !>
:- (from-list [[1 "left"] [2 "2leftright"] [3 "right"] ~])
%^ union-with-key
(from-list [[1 "left"] [2 "left"] ~])
(from-list [[2 "right"] [3 "right"] ~])
|=({a/@ud b/tape c/tape} :(weld `tape`(scow %ud a) b c))
(from-list [[1 "left"] [2 "2leftright"] [3 "right"] ~])
"union-with-key"
|=({a/@ud b/tape c/tape} :(weld `tape`(scow %ud a) b c))
::
++ test-map
%^ expect-eq
%+ map:dct
three
crip
(from-list [[1 'one'] [2 'two'] [3 'three'] ~])
"map"
%- expect-eq !>
:- (from-list [[1 'one'] [2 'two'] [3 'three'] ~])
(map:dct three crip)
::
++ test-map-with-key
%^ expect-eq
%+ map-with-key
three
|=({a/@u b/tape} (weld (scow %ud a) b))
(from-list [[1 "1one"] [2 "2two"] [3 "3three"] ~])
"map-with-key"
%- expect-eq !>
:- (from-list [[1 "1one"] [2 "2two"] [3 "3three"] ~])
%+ map-with-key three
|=({a/@u b/tape} (weld (scow %ud a) b))
::
++ test-map-fold
%^ expect-eq
%^ map-fold
three
"Everything: "
|= {accumulator/tape value/tape}
[(weld accumulator value) (weld value "X")]
:- "Everything: twoonethree"
(from-list [[1 "oneX"] [2 "twoX"] [3 "threeX"] ~])
"map-fold"
%- expect-eq !>
:- :- "Everything: two one three"
(from-list [[1 "oneX"] [2 "twoX"] [3 "threeX"] ~])
%^ map-fold three
"Everything:"
|= {accumulator/tape value/tape}
[:(weld accumulator " " value) (weld value "X")]
::
++ test-map-keys
%^ expect-eq
%+ map-keys
three
|= a/@u
(add a 10)
(from-list [[11 "one"] [12 "two"] [13 "three"] ~])
"map-keys"
%- expect-eq !>
:- (from-list [[11 "one"] [12 "two"] [13 "three"] ~])
%+ map-keys three
|=(a/@u (add a 10))
::
++ test-map-keys-with
%^ expect-eq
%^ map-keys-with
three
%- expect-eq !>
:- (from-list [[42 "twothreeone"] ~])
%^ map-keys-with three
|=(a/@u 42)
weld
(from-list [[42 "twothreeone"] ~])
"map-keys-with"
weld
::
++ test-fold
%^ expect-eq
%^ fold
three
%- expect-eq !>
:- "Everything: twoonethree"
%^ fold three
"Everything: "
:: todo: this works but replacing with just ++weld causes an out of loom.
|= {accumulator/tape value/tape}
^- tape
(weld accumulator value)
"Everything: twoonethree"
"map-fold"
:: todo: this works but replacing with just ++weld causes an out of loom.
|= {accumulator/tape value/tape}
^- tape
(weld accumulator value)
::
++ test-fold-with-keys
%^ expect-eq
%^ fold-with-keys
three
%- expect-eq !>
:- "Everything: 2two1one3three"
%^ fold-with-keys three
"Everything: "
|= {accumulator/tape key/@u value/tape}
^- tape
:(weld accumulator (scow %ud key) value)
"Everything: 2two1one3three"
"map-fold-with-keys"
|= {accumulator/tape key/@u value/tape}
^- tape
:(weld accumulator (scow %ud key) value)
::
++ test-elems
%^ expect-eq
%- expect-eq !>
:- ["two" "three" "one" ~]
(elems three)
["two" "three" "one" ~]
"elems"
::
++ test-keys
%^ expect-eq
%- expect-eq !>
:- [2 3 1 ~]
(keys three)
[2 3 1 ~]
"keys"
::
++ test-keys-set
%^ expect-eq
%- expect-eq !>
:- (si:nl [2 3 1 ~])
(keys-set three)
(si:nl [2 3 1 ~])
"keys-set"
::
++ test-from-set
%^ expect-eq
%+ from-set
%- expect-eq !>
:- (from-list [[1 "1"] [2 "2"] [3 "3"] ~])
%+ from-set
(si:nl [1 2 3 ~])
|= a/@u
(scow %ud a)
(from-list [[1 "1"] [2 "2"] [3 "3"] ~])
"from-set"
|=(a/@u (scow %ud a))
::
++ test-from-list-with
%^ expect-eq
%+ from-list-with
%- expect-eq !>
:- (from-list [[1 1] [2 2] [3 3] ~])
%+ from-list-with
[[1 1] [2 1] [2 1] [3 3] ~]
add
(from-list [[1 1] [2 2] [3 3] ~])
"from-list-with"
add
::
++ test-filter
%^ expect-eq
%+ filter
%- expect-eq !>
:- (from-list [[1 1] [2 1] [4 1] ~])
%+ filter
(from-list [[1 1] [2 1] [3 2] [4 1] ~])
|=(a/@u !=(a 1))
(from-list [[1 1] [2 1] [4 1] ~])
"filter"
|=(a/@u !=(a 1))
::
++ test-filter-with-key
%^ expect-eq
%+ filter-with-key
%- expect-eq !>
:- (from-list [[1 1] [3 2] [4 1] ~])
%+ filter-with-key
(from-list [[1 1] [2 1] [3 2] [4 1] ~])
|=({a/@u b/@u} =(a 2))
(from-list [[1 1] [3 2] [4 1] ~])
"filter-with-key"
|=({a/@u b/@u} =(a 2))
::
++ test-restrict-keys
%^ expect-eq
%+ restrict-keys
%- expect-eq !>
:- (from-list [[1 1] [3 3] [5 5] ~])
%+ restrict-keys
(from-list [[1 1] [2 2] [3 3] [4 4] [5 5] ~])
(si:nl [1 3 5 ~])
(from-list [[1 1] [3 3] [5 5] ~])
"restrict-keys"
(si:nl [1 3 5 ~])
::
++ test-without-keys
%^ expect-eq
%+ without-keys
%- expect-eq !>
:- (from-list [[2 2] [4 4] ~])
%+ without-keys
(from-list [[1 1] [2 2] [3 3] [4 4] [5 5] ~])
(si:nl [1 3 5 ~])
(from-list [[2 2] [4 4] ~])
"restrict-keys"
(si:nl [1 3 5 ~])
::
++ test-partition
%^ expect-eq
%+ partition
%- expect-eq !>
:- :- (from-list [[1 1] [3 3] ~])
(from-list [[2 2] [4 4] [5 5] ~])
%+ partition
(from-list [[1 1] [2 2] [3 3] [4 4] [5 5] ~])
|=(a/@u |(=(a 1) =(a 3)))
:- (from-list [[1 1] [3 3] ~])
(from-list [[2 2] [4 4] [5 5] ~])
"partition"
|=(a/@u |(=(a 1) =(a 3)))
::
++ test-map-maybe
%^ expect-eq
%+ map-maybe
%- expect-eq !>
:- (from-list [[1 1] [2 2] [4 4] [5 5] ~])
%+ map-maybe
(from-list [[1 1] [2 2] [3 3] [4 4] [5 5] ~])
|=(a/@u ?:(=(a 3) ~ `a))
(from-list [[1 1] [2 2] [4 4] [5 5] ~])
"map-maybe"
|=(a/@u ?:(=(a 3) ~ `a))
::
++ test-map-maybe-with-key
%^ expect-eq
%+ map-maybe-with-key
%- expect-eq !>
:- (from-list [[1 2] [2 3] [4 5] [5 6] ~])
%+ map-maybe-with-key
(from-list [[1 2] [2 3] [3 4] [4 5] [5 6] ~])
|=({k/@u v/@u} ?:(=(k 3) ~ `v))
(from-list [[1 2] [2 3] [4 5] [5 6] ~])
"map-maybe-with-key"
|=({k/@u v/@u} ?:(=(k 3) ~ `v))
::
++ test-map-either
%^ expect-eq
%- expect-eq !>
:- :- (from-list [[2 "even"] [4 "even"] ~])
(from-list [[1 1] [3 1] [5 1] ~])
%+ map-either
(from-list [[1 1] [2 2] [3 3] [4 4] [5 5] ~])
|= value/@u
?: =(0 (mod value 2))
[%& "even"]
[%| 1]
:- (from-list [[2 "even"] [4 "even"] ~])
(from-list [[1 1] [3 1] [5 1] ~])
"map-either"
::
++ test-map-either-with-key
%^ expect-eq
%- expect-eq !>
:- :- (from-list [[2 "even"] [4 "even"] ~])
(from-list [[1 1] [3 1] [5 1] ~])
%+ map-either-with-key
(from-list [[1 1] [2 1] [3 1] [4 1] [5 1] ~])
|= {key/@u value/@u}
?: =(0 (mod key 2))
[%& "even"]
[%| 1]
:- (from-list [[2 "even"] [4 "even"] ~])
(from-list [[1 1] [3 1] [5 1] ~])
"map-either"
|= {key/@u value/@u}
?: =(0 (mod key 2))
[%& "even"]
[%| 1]
::
++ test-is-subdict
%^ expect-eq
%^ is-subdict-by
(from-list [[1 1] [4 4] ~])
%- expect-eq !>
:- &
%^ is-subdict-by
(from-list [[1 1] [4 4] ~])
(from-list [[1 1] [2 2] [3 3] [4 4] [5 5] ~])
|=({a/* b/*} =(a b))
%.y
"is-subdict"
|=({a/* b/*} =(a b))
::
++ test-valid
%^ expect-eq
%- expect-eq !>
:- &
(valid (from-list [[1 1] [2 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9] ~]))
%.y
"valid"
--

View File

@ -1,32 +1,31 @@
/+ new-hoon, tester
=, myb:new-hoon
|_ tester-type:tester
|_ _tester:tester
++ test-from-list-null
(expect-eq (from-list ~) ~ "from-list")
(expect-eq !>([~ (from-list ~)]))
::
++ test-from-list-real
(expect-eq (from-list [5 ~]) [~ 5] "from-list")
(expect-eq !>([[~ 5] (from-list [5 ~])]))
::
++ test-to-list-null
(expect-eq (to-list ~) ~ "to-list")
(expect-eq !>([~ (to-list ~)]))
::
++ test-to-list-real
(expect-eq (to-list [~ 5]) [5 ~] "to-list")
(expect-eq !>([[5 ~] (to-list [~ 5])]))
::
++ test-concat-null
(expect-eq (concat ~) ~ "concat")
(expect-eq !>([~ (concat ~)]))
::
++ test-concat-real
:: wait, if i pull the cast out from below, the concat implementation
:: doesn't compile anymore?
(expect-eq (concat `(list (maybe @ud))`[~ [~ 1] ~ [~ 2] ~]) [1 2 ~] "concat")
(expect-eq !>([[1 2 ~] (concat `(list (maybe @ud))`[~ [~ 1] ~ [~ 2] ~])]))
::
++ test-map
%^ expect-eq
%+ map:myb
%- expect-eq !>
:- [2 2 ~]
%+ map:myb
[1 2 3 2 ~]
|=(a/@u ?:(=(2 a) [~ 2] ~))
[2 2 ~]
"map"
|=(a/@u ?:(=(2 a) [~ 2] ~))
--

View File

@ -2,31 +2,26 @@
/+ new-hoon, tester
=, thr:new-hoon
=/ data/(list (either @u tape)) [[%& 1] [%| "one"] [%& 2] [%| "two"] ~]
|_ tester-type:tester
|_ _tester:tester
++ test-apply
%^ expect-eq
%^ apply
`(either @u tape)`[%| "one"]
%- expect-eq !>
:- "right"
%^ apply `(either @u tape)`[%| "one"]
|=(a/@u "left")
|=(b/tape "right")
"right"
"apply"
|=(b/tape "right")
::
++ test-firsts
%^ expect-eq
%- expect-eq !>
:- [1 2 ~]
(firsts data)
[1 2 ~]
"firsts"
::
++ test-seconds
%^ expect-eq
%- expect-eq !>
:- ["one" "two" ~]
(seconds data)
["one" "two" ~]
"seconds"
::
++ test-partition
%^ expect-eq
%- expect-eq !>
:- [[1 2 ~] ["one" "two" ~]]
(partition data)
[[1 2 ~] ["one" "two" ~]]
"partition"
--

View File

@ -0,0 +1,303 @@
:: tests for the keccak hashing algorithms
::
:: answers for keccak from the keccak team:
:: https://keccak.team/archives.html
:: (we swp the inputs because ++keccak wants to work with @t's, which are in
:: reverse byte order)
::
:: since all other hashing algorithms are implemented as keccak, their only
:: difference a single padding byte, we can safely test just one input.
:: answers for those pulled from the nist website:
:: https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
::
:: answer for rawshake-256 was found here:
:: https://github.com/maandree/libkeccak/blob/master/test.c
:: for rawshake-128, the implementation was assumed to be correct at the time
:: these tests were written.
::
::
/+ tester
=, keccak:crypto
::
:: per bytelength, an example input.
=/ keccak-inputs=(map @ud @)
=- (~(run by -) (cury swp 3))
%- ~(gas by *(map @ud @))
^- (list (pair @ud @))
:~
:- 0
0x0
::
:- 1
0xcc
::
:- 4
0xc1ec.fdfc
::
:- 8
0x4a4f.2024.8451.2526
::
:- 64
0xe926.ae8b.0af6.e531.76db.ffcc.2a6b.88c6.
bd76.5f93.9d3d.178a.9bde.9ef3.aa13.1c61.
e31c.1e42.cdfa.f4b4.dcde.579a.37e1.50ef.
bef5.555b.4c1c.b404.39d8.35a7.24e2.fae7
::
:- 128
0x2b6d.b7ce.d866.5ebe.9deb.0802.9521.8426.
bdaa.7c6d.a9ad.d208.8932.cdff.baa1.c141.
29bc.cdd7.0f36.9efb.1492.8585.8d2b.1d15.
5d14.de2f.db68.0a8b.0272.8405.5182.a0ca.
e275.234c.c9c9.2863.c1b4.ab66.f304.cf06.
21cd.5456.5f5b.ff46.1d3b.461b.d40d.f281.
98e3.7325.01b4.860e.add5.03d2.6d6e.6933.
8f4e.0456.e9e9.baf3.d827.ae68.5fb1.d817
::
:- 255
0x3a.3a81.9c48.efde.2ad9.14fb.f00e.18ab.
6bc4.f145.13ab.27d0.c178.a188.b614.31e7.
f562.3cb6.6b23.3467.75d3.86b5.0e98.2c49.
3adb.bfc5.4b9a.3cd3.8338.2336.a1a0.b215.
0a15.358f.336d.03ae.18f6.66c7.573d.55c4.
fd18.1c29.e6cc.fde6.3ea3.5f0a.df58.85cf.
c0a3.d84a.2b2e.4dd2.4496.db78.9e66.3170.
cef7.4798.aa1b.bcd4.574e.a0bb.a404.89d7.
64b2.f83a.adc6.6b14.8b4a.0cd9.5246.c127.
d587.1c4f.1141.8690.a5dd.f012.46a0.c80a.
43c7.0088.b618.3639.dcfd.a412.5bd1.13a8.
f49e.e23e.d306.faac.576c.3fb0.c1e2.5667.
1d81.7fc2.534a.52f5.b439.f72e.424d.e376.
f4c5.65cc.a823.07dd.9ef7.6da5.b7c4.eb7e.
0851.72e3.2880.7c02.d011.ffbf.3378.5378.
d79d.c266.f6a5.be6b.b0e4.a92e.ceeb.aeb1
==
::
|_ tst=_tester:tester
::
:: check a list of bytelength-answer pairs to see if
:: they match the output given by {hash} for the
:: corresponding example input from {keccak-inputs}.
++ verify-known-answers
|= $: hash=$-(octs @)
name=tape
answers=(list (pair @ud @))
==
^- tang
?~ answers ~
%+ weld $(answers t.answers)
=+ `[bytes=@ud answer=@]`i.answers
%+ category.tst name
%- expect-eq.tst !>
:- answer
(hash bytes (~(got by keccak-inputs) bytes))
::
:: keccak
::
++ test-keccak-224
%^ verify-known-answers keccak-224 "keccak-224"
:~ :- 0
0xf718.3750.2ba8.e108.37bd.d8d3.65ad.b855.
9189.5602.fc55.2b48.b739.0abd
::
:- 1
0xa9ca.b59e.b40a.10b2.4629.0f2d.6086.e32e.
3689.faf1.d26b.470c.899f.2802
::
:- 4
0xe405.869d.a146.4a70.5700.a3cb.ce13.1aab.
eeba.9c8d.2fe6.576b.21bc.be16
::
:- 8
0x7a5c.2cb3.f999.dd00.eff7.3999.6331.4ca6.
47dd.0e5a.e1bd.dec6.11f8.338d
::
:- 64
0xc533.dcf8.8cd1.a5df.f22b.914d.3875.bd57.
fc17.b2e1.f474.ae36.0c38.77d2
::
:- 128
0xaf3e.0cc6.e645.01f1.0fd3.9722.e852.355f.
d6d8.0d32.1906.31e2.f06c.22ad
::
:- 255
0x5af5.6987.ea9c.f11f.cd0e.ac5e.bc14.b037.
365e.9b11.23e3.1cb2.dfc7.929a
==
::
++ test-keccak-256
%^ verify-known-answers keccak-256 "keccak-256"
:~ :- 0
0xc5d2.4601.86f7.233c.927e.7db2.dcc7.03c0.
e500.b653.ca82.273b.7bfa.d804.5d85.a470
::
:- 1
0xeead.6dbf.c734.0a56.caed.c044.696a.1688.
7054.9a6a.7f6f.5696.1e84.a54b.d997.0b8a
::
:- 4
0xb149.e766.d761.2eaf.7d55.f74e.1a4f.dd63.
709a.8115.b14f.61fc.d22a.a4ab.c8b8.e122
::
:- 8
0xe620.d8f2.982b.24fe.daaa.3baa.9b46.c3f9.
ce20.4ee3.5666.6553.ecb3.5e15.c3ff.9bf9
::
:- 64
0x5742.71cd.1395.9e8d.deae.5bfb.db02.a3fd.
f54f.2bab.fd0c.beb8.9308.2a97.4957.d0c1
::
:- 128
0xd82e.257d.000d.c9fa.279a.00e2.961e.3286.
d2fe.1c02.ef59.833a.b8a6.a710.1bc2.5054
::
:- 255
0x348f.b774.adc9.70a1.6b11.0566.9442.625e.
6ada.a825.7a89.effd.b5a8.02f1.61b8.62ea
==
::
++ test-keccak-384
%^ verify-known-answers keccak-384 "keccak-384"
:~ :- 0
0x2c23.146a.63a2.9acf.99e7.3b88.f8c2.4eaa.
7dc6.0aa7.7178.0ccc.006a.fbfa.8fe2.479b.
2dd2.b213.6233.7441.ac12.b515.9119.57ff
::
:- 1
0x1b84.e62a.46e5.a201.8617.54af.5dc9.5c4a.
1a69.caf4.a796.ae40.5680.161e.2957.2641.
f5fa.1e86.41d7.9583.36ee.7b11.c58f.73e9
::
:- 4
0xf185.0b2a.bb24.f3fd.683c.7015.8278.9d9e.
92b6.a45f.9c34.5f9d.ae7f.7997.c8c9.10e8.
8003.e592.e592.81cf.92c9.2d6b.51a1.afd1
::
:- 8
0x638e.6575.8a29.7cb0.9ded.1ac5.b9e8.f779.
8020.00ab.791f.67f3.3c60.be36.4437.93ad.
cc8a.4a58.e986.8815.7a41.784f.02a4.bcb2
::
:- 64
0x14aa.679b.0c11.f9c3.63f5.4933.0261.b45e.
1e90.ce31.f4a1.b0ce.5cb9.eb81.bd60.79a3.
742d.8602.356c.5098.5d0d.3e54.0fdf.dcfb
::
:- 128
0x3ade.b7ee.ecf9.069f.143a.1015.1fd4.506a.
eef3.a0ef.94ca.65d4.448a.cf1e.892b.8ebb.
0887.6318.04dd.64e1.53ad.41fa.e012.7a85
::
:- 255
0x6bff.1c84.05a3.fe59.4e36.0e3b.ccea.1ebc.
d509.310d.c79b.9e45.c263.783d.7a5d.d662.
c678.9b18.bd56.7dbd.da15.54f5.bee6.a860
==
::
++ test-keccak-512
%^ verify-known-answers keccak-512 "keccak-512"
:~ :- 0
0xeab.42de.4c3c.eb92.35fc.91ac.ffe7.46b2.
9c29.a8c3.66b7.c60e.4e67.c466.f36a.4304.
c00f.a9ca.f9d8.7976.ba46.9bcb.e067.13b4.
35f0.91ef.2769.fb16.0cda.b33d.3670.680e
::
:- 1
0x8630.c13c.bd06.6ea7.4bbe.7fe4.68fe.c1de.
e10e.dc12.54fb.4c1b.7c5f.d69b.646e.4416.
0b8c.e01d.05a0.908c.a790.dfb0.80f4.b513.
bc3b.6225.ece7.a810.3714.41a5.ac66.6eb9
::
:- 4
0x952d.4c0a.6f0e.f5ce.438c.52e3.edd3.45ea.
00f9.1cf5.da80.97c1.168a.1606.9e95.8fc0.
5bad.90a0.c5fb.4dd9.ec28.e84b.226b.94a8.
47d6.bb89.2356.92ef.4c97.12f0.c703.0fae
::
:- 8
0xf326.c7c1.26dd.c277.9227.60fe.ef77.c9ba.
b6fb.5d34.30f6.5259.3703.d7c5.e301.35cd.
0b05.7525.7509.a624.1843.30d6.ab1f.508a.
6663.91b5.d469.0426.b4e0.5301.891d.f897
::
:- 64
0xc0a4.d8dc.a967.772d.bf6e.5508.c913.e7be.
ba1b.749a.2b1a.c963.d067.6e6f.1dcd.4eba.
a3f9.09ef.87dd.8498.82dc.8253.347a.5f65.
20b5.b9f5.1097.3f44.3976.455f.923c.fcb9
::
:- 128
0xaebb.a57c.8ed5.af6e.c93f.4aa4.5772.ff51.
67b7.ea88.dfa7.1364.f37d.8fc5.fdb7.dc3b.
2c83.31a0.8023.f21d.110b.7d82.1e2d.c7e8.
6082.6235.e7e6.2919.12ac.5213.8474.7354
::
:- 255
0x8195.0e70.96d3.1d4f.22e3.db71.cac7.25bf.
59e8.1af5.4c7c.a9e6.aeee.71c0.10fc.5467.
4663.12a0.1aa5.c137.cfb1.4064.6941.5567.
96f6.12c9.3512.6873.7c7e.9a2b.9631.d1fa
==
::
:: sha3
::
++ test-sha3-224
%- expect-eq.tst !>
:- 0x6b4e.0342.3667.dbb7.3b6e.1545.4f0e.b1ab.
d459.7f9a.1b07.8e3f.5b5a.6bc7
(sha3-224 0 `@`0)
::
++ test-sha3-256
%- expect-eq.tst !>
:- 0xa7ff.c6f8.bf1e.d766.51c1.4756.a061.d662.
f580.ff4d.e43b.49fa.82d8.0a4b.80f8.434a
(sha3-256 0 `@`0)
::
++ test-sha3-384
%- expect-eq.tst !>
:- 0xc63.a75b.845e.4f7d.0110.7d85.2e4c.2485.
c51a.50aa.aa94.fc61.995e.71bb.ee98.3a2a.
c371.3831.264a.db47.fb6b.d1e0.58d5.f004
(sha3-384 0 `@`0)
::
++ test-sha3-512
%- expect-eq.tst !>
:- 0xa69f.73cc.a23a.9ac5.c8b5.67dc.185a.756e.
97c9.8216.4fe2.5859.e0d1.dcc1.475c.80a6.
15b2.123a.f1f5.f94c.11e3.e940.2c3a.c558.
f500.199d.95b6.d3e3.0175.8586.281d.cd26
(sha3-512 0 `@`0)
::
:: shake
::
++ test-shake-128
%- expect-eq.tst !>
:- 0x7f9c.2ba4.e88f.827d.6160.4550.7605.853e.
d73b.8093.f6ef.bc88.eb1a.6eac.fa66.ef26.
3cb1.eea9.8800.4b93.103c.fb0a.eefd.2a68.
6e01.fa4a.58e8.a363.9ca8.a1e3.f9ae.57e2
(shake-128 512 0 `@`0)
::
++ test-shake-256
%- expect-eq.tst !>
:- 0x46b9.dd2b.0ba8.8d13.233b.3feb.743e.eb24.
3fcd.52ea.62b8.1b82.b50c.2764.6ed5.762f.
d75d.c4dd.d8c0.f200.cb05.019d.67b5.92f6.
fc82.1c49.479a.b486.4029.2eac.b3b7.c4be
(shake-256 512 0 `@`0)
::
++ test-rawshake-128
%- expect-eq.tst !>
:- 0xfa01.9a3b.1763.0df6.0148.53b5.4707.73f1.
3c3a.b704.4782.11d7.a658.6751.5dea.1cc7.
926b.2147.e396.076b.22cb.7263.3af5.0647.
c7f2.3d0d.8f00.1d6d.8daf.0f6f.2e92.fc0e
(rawshake-128 512 0 `@`0)
::
++ test-rawshake-256
%- expect-eq.tst !>
:- 0x3a11.08d4.a90a.31b8.5a10.bdce.77f4.bfbd.
cc5b.1d70.dd40.5686.f8bb.de83.4aa1.a410.
db8c.9e1c.166c.3e23.9cd7.6a55.f6a6.92aa.
2d17.49f2.ec79.cd0b.a3b1.7bb6.5995.9b6e
(rawshake-256 512 0 `@`0)
--

View File

@ -1,9 +0,0 @@
::
:::: /hoon/mark-dashboard/web
::
/? 310
;div.mini-module
;script@"/~/at/lib/js/urb.js";
;mark-dashboard;
;script@"main.js";
==

View File

@ -1,29 +0,0 @@
TreeActions = window.tree.actions
d = React.DOM
TreeActions.registerComponent("mark-dashboard", React.createClass({
render: function(){
return d.ul({},
!this.state.data ? "loading..." :
_(this.state.data)
.map(function(result,mark){return {result:result, mark:mark}})
.sortBy('mark')
.map(function(x){
return d.li({key:x.mark},"%"+x.mark, " ",
(!/\n/.test(x.result) ? d.code({},x.result) : d.pre({},d.code({},x.result)))
)})
.value()
)},
getInitialState: function(){ return {data:null}},
componentDidMount: function(){
$this = this
urb.bind("/scry/x/main",
{appl:"mark-dashboard"},
function(err, dat){
urb.drop("/scry/x/main", {appl:"mark-dashboard"})
$this.setState({data:dat.data})
}
)
}
}))

View File

@ -1041,7 +1041,7 @@ Member = require('./MemberComponent.coffee');
SHIPSHAPE = /^~?([a-z]{3}|[a-z]{6}(-[a-z]{6}){0,3}|[a-z]{6}(-[a-z]{6}){3}(--[a-z]{6}(-[a-z]{6}){3})+)$/;
PO = 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\nrigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\nholpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\nlosdilforpilramtirwintadbicdifrocwidbisdasmidlop\nrilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\nritpodmottamtolsavposnapnopsomfinfonbanporworsip\nronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\nsivtagpadsaldivdactansidfabtarmonranniswolmispal\nlasdismaprabtobrollatlonnodnavfignomnibpagsopral\nbilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ntaclabmogsimsonpinlomrictapfirhasbosbatpochactid\nhavsaplindibhosdabbitbarracparloddosbortochilmac\ntomdigfilfasmithobharmighinradmashalraglagfadtop\nmophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\nnimlarfitwalrapsarnalmoslandondanladdovrivbacpol\nlaptalpitnambonrostonfodponsovnocsorlavmatmipfap\n\nzodnecbudwessevpersutletfulpensytdurwepserwylsun\nrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\nlunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\npyldulhetmevruttylwydtepbesdexsefwycburderneppur\nrysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\nsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\nselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\nsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\nlytdusnebrumtynseglyxpunresredfunrevrefmectedrus\nbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ntenlusnussyltecmexpubrymtucfyllepdebbermughuttun\nbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\nwedducfurfexnulluclennerlexrupnedlecrydlydfenwel\nnydhusrelrudneshesfetdesretdunlernyrsebhulryllud\nremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\nlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes';
PO = 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\nrigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\nholpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\nlosdilforpilramtirwintadbicdifrocwidbisdasmidlop\nrilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\nritpodmottamtolsavposnapnopsomfinfonbanmorworsip\nronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\nsivtagpadsaldivdactansidfabtarmonranniswolmispal\nlasdismaprabtobrollatlonnodnavfignomnibpagsopral\nbilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ntaclabmogsimsonpinlomrictapfirhasbosbatpochactid\nhavsaplindibhosdabbitbarracparloddosbortochilmac\ntomdigfilfasmithobharmighinradmashalraglagfadtop\nmophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\nnimlarfitwalrapsarnalmoslandondanladdovrivbacpol\nlaptalpitnambonrostonfodponsovnocsorlavmatmipfip\n\nzodnecbudwessevpersutletfulpensytdurwepserwylsun\nrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\nlunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\npyldulhetmevruttylwydtepbesdexsefwycburderneppur\nrysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\nsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\nselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\nsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\nlytdusnebrumtynseglyxpunresredfunrevrefmectedrus\nbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ntenlusnussyltecmexpubrymtucfyllepdebbermughuttun\nbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\nwedducfurfexnulluclennerlexrupnedlecrydlydfenwel\nnydhusrelrudneshesfetdesretdunlernyrsebhulryllud\nremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\nlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes';
textToHTML = function(txt) {
return {

View File

@ -9,28 +9,34 @@ shape can go in `%/tests` and then are exposed to a system wide test runner.
Say you put a test suite in `%/tests/new-hoon/thr.hoon`:
> +ls %/tests
new-hoon/
> +ls %/tests/new-hoon
ls/hoon mp/hoon myb/hoon thr/hoon
```
> +ls %/tests
new-hoon/
> +ls %/tests/new-hoon
ls/hoon mp/hoon myb/hoon thr/hoon
```
You can then just run that individual test suite (and not the ones that are beside it in the `%/tests/new-hoon` directory) with:
> +tests /new-hoon/thr
/new-hoon/thr/test-seconds OK
/new-hoon/thr/test-partition OK
/new-hoon/thr/test-firsts OK
/new-hoon/thr/test-apply OK
```
> +tests /new-hoon/thr
/new-hoon/thr/test-seconds OK
/new-hoon/thr/test-partition OK
/new-hoon/thr/test-firsts OK
/new-hoon/thr/test-apply OK
```
## The test file
So what is the structure of these test files? They contain a door, with arms starting with `++test-` or `++check-`. At minimum:
/+ tester
|_ tester-type:tester
++ test-some-test
(expect-eq 4 4 "trivial")
--
```
/+ tester
|_ tester-type:tester
++ test-some-test
(expect-eq 4 4 "trivial")
--
```
All of the utilities you need to write tests are in the tester library. Also, like other hoon files, you can stack cores for models and utility functions with only the final core being inspected for test arms.

View File

@ -423,13 +423,6 @@ div.logo.inverse:before {
margin-left: .05rem;
font-size: 1rem; } }
[data-path^='/docs/system/hoon/runes'] .nav-link {
font-family: 'scp'; }
[data-path^='/docs/system/hoon/runes'] .nav-link,
[data-path^='/docs/system/hoon/runes'] .ctrl .selected a.nav-link {
font-weight: 600; }
.app {
vertical-align: top;
font-size: 1.6rem;
@ -649,21 +642,38 @@ ol > li:before {
margin-right: 1rem;
margin-left: -2rem; }
.body[data-path*='/docs'] h1,
.body[data-path^='/work'] h1 {
color: #000; }
.body[data-path*='/docs'] h1 code,
.body[data-path^='/work'] h1 code {
background-color: transparent;
color: #000;
padding: 0; }
padding: 0;
font-size: 100%;
font-weight: 500; }
.body[data-path*='/docs'] .head,
.body[data-path^='/work'] .head {
margin-bottom: 4rem;
padding-left: 0; }
.body[data-path*='/docs'] p.label,
.body[data-path^='/work'] p.label {
font-size: .8rem;
padding: 0;
display: block;
text-align: left;
margin-bottom: .6rem; }
.body[data-path*='/docs'] p.label .type,
.body[data-path^='/work'] p.label .type {
background-color: #B1B7BD;
color: #fff;
padding: .4rem;
margin-right: .3rem; }
.body[data-path*='/docs'] p.label code,
.body[data-path^='/work'] p.label code {
background-color: transparent;
font-size: 100%;
font-weight: 400; }
.body[data-path*='/docs'] .book h2,
.body[data-path^='/work'] .book h2 {
color: #B1B7BD; }
@ -681,24 +691,21 @@ ol > li:before {
.body[data-path^='/work'] .book hr {
margin-bottom: 3rem; }
.body[data-path*='/docs'] .book img,
.body[data-path^='/work'] .book img {
max-width: 100%; }
.body[data-path^='/work'] h2 {
color: #000; }
.body[data-path^='/docs/system/hoon/runes/'] h1 {
color: #B1B7BD; }
.more {
border-bottom: 0.1rem solid #000; }
.body[data-path^='/docs/system/hoon/runes/basic'] h1 {
color: #000; }
.body[data-path^='/docs/system/hoon/library/'] h3 {
font-size: 1.5rem; }
.body[data-path^='/docs/system/hoon/library/'] h2 {
font-size: 1rem; }
.body[data-path^='/docs/system/hoon/library/'] .toc h3 {
padding-top: 0;
margin-bottom: 0; }
.more::after {
content: "→";
font-family: "scp";
font-weight: 600;
padding-left: .3rem; }
.body .urbit {
padding-bottom: 9rem; }
@ -1161,6 +1168,9 @@ ol > li:before {
font-size: 1.6rem;
font-weight: 500; }
.list.spaced li {
margin-bottom: 2rem; }
.list.children h1 {
font-weight: 500;
font-size: 1.4rem; }
@ -1178,6 +1188,9 @@ ol > li:before {
content: "—";
margin-right: .6rem; }
.list.p.code {
background-color: transparent; }
.body[data-path*='/docs'] .list,
.body[data-path^='/work'] .list {
list-style-type: none;
@ -1186,11 +1199,15 @@ ol > li:before {
.body[data-path*='/docs'] .list h1,
.body[data-path^='/work'] .list a,
.body[data-path^='/work'] .list h1 {
color: #55595c;
color: #000;
font-weight: 500;
height: 2rem;
display: inline;
text-decoration: none; }
.body[data-path*='/docs'] .list p a,
.body[data-path^='/work'] .list p a {
font-weight: 400;
text-decoration: underline; }
.body[data-path*='/docs'] .list h1,
.body[data-path^='/work'] .list h1 {
border-bottom: 2px solid #000; }
@ -1367,8 +1384,7 @@ ol > li:before {
display: none; }
.sections h1 {
font-size: 2rem;
color: #0500F0; }
font-size: 2rem; }
.sections h1:first-of-type {
padding-bottom: 1rem; }