Merge branch 'master' of git://factorcode.org/git/factor
commit
b1243dc1be
|
@ -89,4 +89,4 @@ PRIVATE>
|
||||||
-> locationInWindow f -> convertPoint:fromView:
|
-> locationInWindow f -> convertPoint:fromView:
|
||||||
[ CGPoint-x ] [ CGPoint-y ] bi
|
[ CGPoint-x ] [ CGPoint-y ] bi
|
||||||
] [ drop -> frame CGRect-h ] 2bi
|
] [ drop -> frame CGRect-h ] 2bi
|
||||||
swap - 2array ;
|
swap - [ >integer ] bi@ 2array ;
|
||||||
|
|
|
@ -62,7 +62,9 @@ ARTICLE: "first-program-test" "Testing your first program"
|
||||||
""
|
""
|
||||||
": palindrome? ( str -- ? ) dup reverse = ;"
|
": palindrome? ( str -- ? ) dup reverse = ;"
|
||||||
}
|
}
|
||||||
"We will now test our new word in the listener. First, push a string on the stack:"
|
"We will now test our new word in the listener. First we have add the palindrome vocabulary to the listener's vocabulary search path:"
|
||||||
|
{ $code "USE: palindrome"}
|
||||||
|
"Next, push a string on the stack:"
|
||||||
{ $code "\"hello\"" }
|
{ $code "\"hello\"" }
|
||||||
"Note that the stack display in the listener now shows this string. Having supplied the input, we call our word:"
|
"Note that the stack display in the listener now shows this string. Having supplied the input, we call our word:"
|
||||||
{ $code "palindrome?" }
|
{ $code "palindrome?" }
|
||||||
|
@ -132,6 +134,8 @@ $nl
|
||||||
$nl
|
$nl
|
||||||
"We modify " { $snippet "palindrome?" } " to first apply " { $snippet "normalize" } " to its input:"
|
"We modify " { $snippet "palindrome?" } " to first apply " { $snippet "normalize" } " to its input:"
|
||||||
{ $code ": palindrome? ( str -- ? ) normalize dup reverse = ;" }
|
{ $code ": palindrome? ( str -- ? ) normalize dup reverse = ;" }
|
||||||
|
"Factor compiles the file from the top down. So, be sure to place the definition for " { $snippet "normalize" } " above the definition for " { $snippet "palindrome?" } "."
|
||||||
|
$nl
|
||||||
"Now if you press " { $command tool "common" refresh-all } ", the source file should reload without any errors. You can run unit tests again, and this time, they will all pass:"
|
"Now if you press " { $command tool "common" refresh-all } ", the source file should reload without any errors. You can run unit tests again, and this time, they will all pass:"
|
||||||
{ $code "\"palindrome\" test" } ;
|
{ $code "\"palindrome\" test" } ;
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,8 @@ IN: tools.deploy.shaker
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
: strip-vocab-globals ( except names -- words )
|
: strip-vocab-globals ( except names -- words )
|
||||||
[ child-vocabs [ words ] map concat ] map concat swap diff ;
|
[ child-vocabs [ words ] map concat ] map concat
|
||||||
|
swap [ first2 lookup ] map sift diff ;
|
||||||
|
|
||||||
: stripped-globals ( -- seq )
|
: stripped-globals ( -- seq )
|
||||||
[
|
[
|
||||||
|
@ -245,7 +246,8 @@ IN: tools.deploy.shaker
|
||||||
strip-dictionary? [
|
strip-dictionary? [
|
||||||
"libraries" "alien" lookup ,
|
"libraries" "alien" lookup ,
|
||||||
|
|
||||||
{ } { "cpu" "compiler" } strip-vocab-globals %
|
{ { "yield-hook" "compiler.utilities" } }
|
||||||
|
{ "cpu" "compiler" } strip-vocab-globals %
|
||||||
|
|
||||||
{
|
{
|
||||||
gensym
|
gensym
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: db.tuples locals site-watcher site-watcher.db
|
USING: db.tuples locals site-watcher site-watcher.db
|
||||||
site-watcher.private kernel db io.directories io.files.temp
|
site-watcher.private kernel db io.directories io.files.temp
|
||||||
continuations db.sqlite site-watcher.db.private ;
|
continuations site-watcher.db.private db.sqlite
|
||||||
|
sequences tools.test ;
|
||||||
IN: site-watcher.tests
|
IN: site-watcher.tests
|
||||||
|
|
||||||
|
[ "site-watcher.db" temp-file delete-file ] ignore-errors
|
||||||
|
|
||||||
:: fake-sites ( -- seq )
|
:: fake-sites ( -- seq )
|
||||||
[
|
"site-watcher.db" temp-file <sqlite-db> [
|
||||||
account ensure-table
|
account ensure-table
|
||||||
site ensure-table
|
site ensure-table
|
||||||
watching-site ensure-table
|
watching-site ensure-table
|
||||||
|
@ -17,5 +20,6 @@ IN: site-watcher.tests
|
||||||
|
|
||||||
"erg@factorcode.org" "http://asdfasdfasdfasdfqwerqqq.com" watch-site
|
"erg@factorcode.org" "http://asdfasdfasdfasdfqwerqqq.com" watch-site
|
||||||
f <site> select-tuples
|
f <site> select-tuples
|
||||||
] with-sqlite-db ;
|
] with-db ;
|
||||||
|
|
||||||
|
[ f ] [ fake-sites empty? ] unit-test
|
Loading…
Reference in New Issue