Merge pull request #695 from ohAitch/test-rens

test ren/ on CI
This commit is contained in:
Anton Dyudin 2018-04-05 15:20:22 -07:00 committed by GitHub
commit db308d7e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 146 additions and 48 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

BIN
.travis/package-lock.json generated Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
require! <[ stream stream-snitch colors escape-string-regexp ]>
pty = require \pty.js
export ERROR = /(ford: |\r\x1b\[K\/~)/
export ERROR = /((ford|warn): |\r\x1b\[K\/~)/
export class Urbit
(args)->
@stdout = process.stdout # overridable

View File

@ -29,6 +29,21 @@ Promise.resolve urbit
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?

View File

@ -1,19 +1,51 @@
::
|%
++ 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 ^ ~] b)
=/ cur p.i.p.b
%- %- slog
?+ -.cur !!
%| (flop p.cur)
%& ~ ::[(sell q.p.cur)]~
==
?> ?=([%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 ~)
@ -30,17 +62,54 @@
[[%core now-beak a] [%$ %cont !>(b)]]
==
::
++ poke-noun
|= [%cores a=path] ::TODO restore historical [%marks ~] handler
:_ +>
?: [dry=|]
~&((list-cores a) ~)
[ost (build-core [- +]:(list-cores a))]~
++ 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)]~
::
++ list-cores
|= a/path ^- (list spur)
=/ sup (flop a)
~& [%findining-hoons under=a]
++ 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
@ -48,43 +117,46 @@
dir:.^(arch %cy (en-beam now-beak sup))
|= [a=knot ~] ^- (list spur)
=. sup [a sup]
?: (~(has in skips) (flop sup))
~&(> [(flop sup) %skipped] ~)
?: (~(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])
++ skips
%- sy :~ ::TODO don't hardcode
/app/gh :: hangs for some reason
/mar/gh :: hangs for some reason
/mar/twit :: slow and/or crash
/ren/test-tree :: recursive
/sys :: generally out of scope
++ 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/pipe :: wants "flavor"
/gen/capitalize :: wants unicode-data/txt
:- /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
::
/lib/down-jet/parse :: // nonsense
/lib/down-jet/rend :: // nonsense
/lib/hood/drum :: ford can't handle surs from libs
/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
/ren/css :: not meant to be called outside /web/pack
/ren/js :: not meant to be called outside /web/pack
/ren/rss-xml :: uses /$
/ren/run :: not meant to be called except on a (different) hoon file
/ren/tree/body :: uses ren/tree
/ren/tree/head :: uses /$
/ren/tree/json :: uses /$
/ren/urb :: uses ren/tree
/ren/urb/tree :: uses ren/tree
/sys/arvo :: BROKEN
/sys/vane/jael :: expects our
/sys/vane/xmas :: expects our
:- /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.