Merge remote-tracking branch 'origin/master' into modern-harvey2

modern-harvey2
Doug Coleman 2018-02-18 11:29:09 -06:00
commit a2e8fb9050
474 changed files with 1093 additions and 933 deletions

View File

@ -154,7 +154,7 @@ ARTICLE: "c-pointers" "Passing pointers to C functions"
ARTICLE: "c-boxes" "C value boxes"
"Sometimes it is useful to create a byte array storing a single C value, like a struct with a single field. A pair of utility words exist to make this more convenient:"
{ $subsections <ref> deref }
"These words can be used to in conjuction with, or instead of, " { $link with-out-parameters } " to handle \"out-parameters\". For example, if a function is declared in the following way:"
"These words can be used to in conjunction with, or instead of, " { $link with-out-parameters } " to handle \"out-parameters\". For example, if a function is declared in the following way:"
{ $code
"FUNCTION: int do_foo ( int* a )"
}

View File

@ -1,14 +1,23 @@
USING: accessors calendar calendar.format io io.streams.string
kernel math.order sequences tools.test ;
USING: accessors calendar calendar.format sequences tools.test ;
IN: calendar.format.tests
{ } [ now timestamp>rfc3339 drop ] unit-test
{ } [ now timestamp>rfc822 drop ] unit-test
CONSTANT: testtime T{ timestamp
{ year 2018 }
{ month 2 }
{ day 15 }
{ hour 8 }
{ minute 51 }
{ second 44+423303/500000 }
{ gmt-offset T{ duration { hour -8 } } }
}
{ "2018-02-15T08:51:44.846606-08:00" } [ testtime timestamp>rfc3339 ] unit-test
{ "Thu, 15 Feb 2018 08:51:44 -0800" } [ testtime timestamp>rfc822 ] unit-test
{ }
[ { 2008 2009 } [ year. ] each ] unit-test
{ "03:01:59" } [
3 hours 1 >>minute 59 >>second duration>hms
] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2016 Alexander Ilin.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test checksums checksums.crc16 ;
IN: checksums.crc16.tests
{ B{ 0xb8 0x80 } } [
B{ 0x01 0x04 0x02 0xFF 0xFF } crc16 checksum-bytes

View File

@ -1,19 +1,17 @@
! Copyright (C) 2010 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: checksums checksums.internet tools.test ;
IN: checksums.internet.tests
{ B{ 255 255 } } [ { } internet checksum-bytes ] unit-test
{ B{ 254 255 } } [ { 1 } internet checksum-bytes ] unit-test
{ B{ 254 253 } } [ { 1 2 } internet checksum-bytes ] unit-test
{ B{ 251 253 } } [ { 1 2 3 } internet checksum-bytes ] unit-test
: test-data ( -- bytes )
{ B{ 34 13 } } [
B{
0x00 0x01
0xf2 0x03
0xf4 0xf5
0xf6 0xf7
} ;
{ B{ 34 13 } } [ test-data internet checksum-bytes ] unit-test
} internet checksum-bytes
] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2017 Jon Harper.
! See http://factorcode.org/license.txt for BSD license.
USING: checksums checksums.ripemd strings tools.test ;
IN: checksums.ripemd.tests
{ B{
0x9c 0x11 0x85 0xa5 0xc5

View File

@ -3,9 +3,6 @@ checksums.sha.private io.encodings.binary io.streams.byte-array
kernel math.parser sequences tools.test random ;
IN: checksums.sha.tests
: test-checksum ( text identifier -- checksum )
checksum-bytes bytes>hex-string ;
{ "a9993e364706816aba3e25717850c26c9cd0d89d" } [ "abc" sha1 checksum-bytes bytes>hex-string ] unit-test
{ "84983e441c3bd26ebaae4aa1f95129e5e54670f1" } [ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" sha1 checksum-bytes bytes>hex-string ] unit-test
! [ "34aa973cd4c4daa4f61eeb2bdbad27316534016f" ] [ 1000000 char: a fill string>sha1str ] unit-test ! takes a long time...
@ -16,36 +13,36 @@ IN: checksums.sha.tests
{ "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525" }
[
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
sha-224 test-checksum
sha-224 checksum-bytes bytes>hex-string
] unit-test
{ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
[ "" sha-256 test-checksum ] unit-test
[ "" sha-256 checksum-bytes bytes>hex-string ] unit-test
{ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" }
[ "abc" sha-256 test-checksum ] unit-test
[ "abc" sha-256 checksum-bytes bytes>hex-string ] unit-test
{ "f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650" }
[ "message digest" sha-256 test-checksum ] unit-test
[ "message digest" sha-256 checksum-bytes bytes>hex-string ] unit-test
{ "71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73" }
[ "abcdefghijklmnopqrstuvwxyz" sha-256 test-checksum ] unit-test
[ "abcdefghijklmnopqrstuvwxyz" sha-256 checksum-bytes bytes>hex-string ] unit-test
{ "db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0" }
[
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
sha-256 test-checksum
sha-256 checksum-bytes bytes>hex-string
] unit-test
{ "f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e" }
[
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
sha-256 test-checksum
sha-256 checksum-bytes bytes>hex-string
] unit-test
! [ "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909" ]
! [ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" sha-512 test-checksum ] unit-test
! [ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" sha-512 checksum-bytes bytes>hex-string ] unit-test
{
t

View File

@ -46,7 +46,7 @@ HELP: basic-block
}
}
}
{ $notes "A basic-block is an " { $link identity-tuple } " becase it is used as a hash table key by the compiler." } ;
{ $notes "A basic-block is an " { $link identity-tuple } " because it is used as a hash table key by the compiler." } ;
HELP: <basic-block>
{ $values { "bb" basic-block } }

View File

@ -53,7 +53,7 @@ HELP: ##alien-indirect
HELP: ##allot
{ $class-description
"An instruction for allocating memory in the nursery. Usually the instruction is preceeded by " { $link ##check-nursery-branch } " which checks that there is enough room in the nursery to allocate. It has the following slots:"
"An instruction for allocating memory in the nursery. Usually the instruction is preceded by " { $link ##check-nursery-branch } " which checks that there is enough room in the nursery to allocate. It has the following slots:"
{ $table
{ { $slot "dst" } { "Register to put the pointer to the memory in." } }
{ { $slot "size" } { "Number of bytes to allocate." } }

View File

@ -12,7 +12,7 @@ HELP: destruct-ssa
{ $description "Main entry point for the SSA destruction compiler pass." } ;
ARTICLE: "compiler.cfg.ssa.destruction" "SSA Destruction"
"SSA destruction compiler pass. It is preceeded by " { $vocab-link "compiler.cfg.save-contexts" } " and followed by " { $vocab-link "compiler.cfg.linear-scan" } "."
"SSA destruction compiler pass. It is preceded by " { $vocab-link "compiler.cfg.save-contexts" } " and followed by " { $vocab-link "compiler.cfg.linear-scan" } "."
$nl
"Because of the design of the register allocator, this pass has three peculiar properties."
{ $list

View File

@ -18,7 +18,7 @@ HELP: pending
{ $class-description "A stack location is pending at a location if all paths from the entry block to the location write the location." } ;
ARTICLE: "compiler.cfg.stacks.global" "Global stack analysis"
"This vocab defines a bunch of dataflow analysises:"
"This vocab defines a bunch of dataflow analyses:"
{ $subsections avail anticip dead live pending }
"The info they gather is used by " { $link finalize-stack-shuffling } " for optimal insertion of " { $link ##peek } " and " { $link ##replace } " instructions." ;

View File

@ -38,7 +38,7 @@ HELP: gc-map-needed?
HELP: gc-root-offsets
{ $values { "gc-map" gc-map } { "offsets" sequence } }
{ $description "Gets the offets of all roots in a gc-map. The " { $link cfg } " variable must have been set and the stack-frame slot been initialized." } ;
{ $description "Gets the offsets of all roots in a gc-map. The " { $link cfg } " variable must have been set and the stack-frame slot been initialized." } ;
HELP: serialize-gc-maps
{ $values { "byte-array" byte-array } }

View File

@ -51,7 +51,7 @@ HELP: rel-decks-offset
HELP: rel-literal
{ $values { "literal" "a literal" } { "class" "a relocation class" } }
{ $description "Adds a refrence to a literal value to the current code offset." } ;
{ $description "Adds a reference to a literal value to the current code offset." } ;
HELP: rel-safepoint
{ $values { "class" "a relocation class" } }

View File

@ -17,18 +17,19 @@ HELP: interval-constraint
{ $class-description "An interval constraint." } ;
HELP: literal-constraint
{ $class-description "A literal constraint" } ;
{ $class-description "A literal constraint." } ;
HELP: satisfied?
{ $values { "constraint" "a constraint" } { "?" boolean } }
{ $description "satisfied? is inaccurate. It's just used to prevent infinite loops so its only implemented for true-constraints and false-constraints." } ;
{ $description "The name " { $snippet "satisfied?" } " is imprecise. This word is used to prevent infinite loops, so it is only implemented for " { $link true-constraint } " and " { $link false-constraint } "." } ;
ARTICLE: "compiler.tree.propagation.constraints" "Support for predicated value info"
"A constraint is a statement about a value."
"A constraint is a statement about a value. The " { $vocab-link "compiler.tree.propagation.constraints" } " vocabulary implements these constraints for propagation of values through the compilation process."
$nl
"Boolean constraints:"
{ $subsections true-constraint true-constraint }
{ $subsections true-constraint false-constraint }
"Utilities:"
{ $subsections t--> f--> } ;
ABOUT: "compiler.tree.propagation.constraints"

View File

@ -31,7 +31,7 @@ HELP: n-bit-version-of
ARTICLE: "cpu.x86.assembler.operands" "CPU x86 registers and memory operands"
"Indirect operand constructors for various addressing formats:"
{ $subsections [] [RIP+] [+] [++] [+*2+] [+*4+] [+*8+] }
"Register correspondances:"
"Register correspondences:"
{ $subsections
8-bit-version-of
16-bit-version-of

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel continuations fry words ;
USING: continuations kernel ;
IN: db.errors
ERROR: db-error ;

View File

@ -46,11 +46,10 @@ M: retryable execute-statement* ( statement type -- )
: sql-props ( class -- columns table )
[ db-columns ] [ db-table-name ] bi ;
: query-make ( class quot -- statements )
: query-make ( ..a class quot: ( ..a columns table -- ..b ) -- ..b statements )
! query, input, outputs, secondary queries
over db-table-name "table-name" set
[ sql-props ] dip
[ 0 sql-counter rot with-variable ] curry
'[ 0 sql-counter [ dup "table-name" set @ ] with-variable ]
{ "" { } { } { } } nmake
[ <simple-statement> maybe-make-retryable ] dip
[ [ 1array ] dip append ] unless-empty ; inline

View File

@ -256,7 +256,7 @@ M: sqlite-db-connection persistent-table ( -- assoc )
" interpolate>string ;
: can-be-null? ( -- ? )
"sql-spec" get modifiers>> [ +not-null+ = ] any? not ;
"sql-spec" get modifiers>> [ +not-null+ = ] none? ;
: delete-cascade? ( -- ? )
"sql-spec" get modifiers>> { +on-delete+ +cascade+ } swap subseq? ;
@ -280,8 +280,6 @@ M: sqlite-db-connection persistent-table ( -- assoc )
: create-db-triggers ( sql-specs -- )
[ modifiers>> [ +foreign-id+ = ] deep-any? ] filter
[
[ class>> db-table-name "db-table" set ]
[
[ "sql-spec" set ]
[ column-name>> "table-id" set ]
@ -292,7 +290,6 @@ M: sqlite-db-connection persistent-table ( -- assoc )
[ third "foreign-table-id" set ] bi
create-sqlite-triggers
] each
] bi
] each ;
: sqlite-create-table ( sql-specs class-name -- )

View File

@ -40,13 +40,11 @@ GENERIC: eval-generator ( singleton -- object )
: query-modify-tuple ( tuple statement -- )
[ query-results [ sql-row-typed ] with-disposal ] keep
out-params>> rot [
[ slot-name>> ] dip set-slot-named
] curry 2each ;
out-params>> rot '[ slot-name>> _ set-slot-named ] 2each ;
: with-disposals ( object quotation -- )
over sequence? [
[ with-disposal ] curry each
over '[ _ dispose-each ] [ ] cleanup
] [
with-disposal
] if ; inline
@ -73,7 +71,8 @@ PRIVATE>
! High level
ERROR: no-slots-named class seq ;
: check-columns ( class columns -- )
: check-columns ( columns class -- )
[ nip ] [
[ keys ]
[ all-slots [ name>> ] map ] bi* diff
@ -155,5 +154,4 @@ ERROR: no-defined-persistent object ;
: count-tuples ( query/tuple -- n )
>query [ tuple>> ] [ <count-statement> ] bi do-count
dup length 1 =
[ first first string>number ] [ [ first string>number ] map ] if ;
[ first string>number ] map dup length 1 = [ first ] when ;

View File

@ -32,8 +32,7 @@ SYMBOLS: +autoincrement+ +serial+ +unique+ +default+ +null+ +not-null+
SYMBOL: IGNORE
: filter-ignores ( tuple specs -- specs' )
[ <mirror> [ nip IGNORE = ] assoc-filter keys ] dip
[ slot-name>> swap member? ] with reject ;
[ <mirror> ] dip [ slot-name>> of IGNORE = ] with reject ;
ERROR: not-persistent class ;

View File

@ -77,14 +77,12 @@ CONSTANT: doc-start { 0 0 }
: (doc-range) ( from to line# document -- slice )
[ start/end-on-line ] 2keep doc-line <slice> ;
: text+loc ( lines loc -- loc )
over [
over length 1 = [
nip first2
:: text+loc ( lines loc -- loc )
lines length 1 = [
loc first2
] [
first swap length 1 - + 0
] if
] dip last length + 2array ;
loc first lines length 1 - + 0
] if lines last length + 2array ;
: prepend-first ( str seq -- )
0 swap [ append ] change-nth ;

View File

@ -11,6 +11,6 @@ ARTICLE: "editors.vim" "Vim support"
{ "If you want to start vim in an extra terminal, use something like this:" { $code "{ \"urxvt\" \"-e\" \"vim\" } vim-path set-global" } "Replace " { $snippet "urxvt" } " by your terminal of choice." }
}
$nl
"You may also wish to install Vim support files to enable syntax hilighting and other features. These are in the " { $link resource-path } " in " { $snippet "misc/vim" } "."
"You may also wish to install Vim support files to enable syntax highlighting and other features. These are in the " { $link resource-path } " in " { $snippet "misc/vim" } "."
{ $see-also "editor" }
;

View File

@ -1 +1,2 @@
John Benediktsson
Cat Stevens

View File

@ -0,0 +1,203 @@
! Copyright (C) 2018 Cat Stevens
USING: arrays assocs help.markup help.syntax kernel math multiline
sequences strings ;
IN: english
<PRIVATE
: $0-plurality ( children -- )
drop {
"Due to the unique way in which the English language is structured, the number "
{ $snippet "0" }
" is considered plural; "
{ $snippet "1" }
" is the only singular quantity."
} print-element ;
: $keep-case ( children -- )
drop
"This word attempts to preserve the letter case style of the input." print-element ;
PRIVATE>
ABOUT: "english"
ARTICLE: "english" "English natural language transformations"
"The " { $vocab-link "english" } " vocabulary implements a few simple ways of interacting with text in the English language, for improving generated text."
$nl
"Plural and singular forms:"
{ $subsections plural? pluralize ?pluralize count-of-things singular? singularize }
"Toy grammatical words:"
{ $subsections a/an ?plural-article a10n comma-list }
"An example application:"
{ $subsections or-markup-example $or-markup-example } ;
{ pluralize ?pluralize plural? count-of-things singularize singular? } related-words
{ a/an ?plural-article a10n comma-list $or-markup-example or-markup-example } related-words
HELP: singularize
{ $values { "word" string } { "singular" string } }
{ $description "Determine the singular form of the input English word. If the input is already singular, it is returned unchanged." }
{ $notes $keep-case }
{ $examples
{ $example
"USING: english io ;"
"\"CATS\" singularize print"
"CAT"
}
{ $example
"USING: english io ;"
"\"Octopi\" singularize print"
"Octopus"
}
} ;
HELP: singular?
{ $values { "word" string } { "?" boolean } }
{ $description "Attempt to determine whether the word is in singular form." }
{ $examples
{ $example
"USING: english prettyprint ;"
"\"octopi\" plural? ."
"t"
}
} ;
HELP: pluralize
{ $values { "word" string } { "plural" string } }
{ $description "Determine the plural form of the input English word. If the input is already plural, it " { $emphasis "might" } " be returned unchanged." }
{ $notes { $list { "If the input is already in plural form, an invaid construct such as " { $emphasis "friendses" } " may be generated. This is difficult to avoid due to the unpredictable structure of the English language." } $keep-case } }
{ $examples
{ $example
"USING: english io ;"
"\"CAT\" pluralize print"
"CATS"
}
{ $example
"USING: english io ;"
"\"Octopus\" pluralize print"
"Octopi"
}
} ;
HELP: plural?
{ $values { "word" string } { "?" boolean } }
{ $description "Attempt to determine whether the word is in plural form." }
{ $examples
{ $example
"USING: english prettyprint ;"
"\"octopus\" singular? ."
"t"
}
} ;
HELP: count-of-things
{ $values { "count" number } { "word" string } { "str" string } }
{ $description "Transform a quantity and a word into a construct consisting of the quantity, and the correct plural or singular form of the word. " { $snippet "word" } " is expected to be in singular form." }
{ $notes { $list $keep-case $0-plurality } }
{ $examples
{ $example
"USING: english io ;"
"10 \"baby\" count-of-things print"
"10 babies"
}
{ $example
"USING: english io ;"
"2.5 \"FISH\" count-of-things print"
"2.5 FISH"
}
} ;
HELP: ?pluralize
{ $values { "count" number } { "singular" string } { "singluar/plural" string } }
{ $description "A simpler variant of " { $link count-of-things } " which omits its input value from the output. As with " { $link count-of-things } ", " { $snippet "word" } " is expected to be in singular form." }
{ $notes { $list $keep-case $0-plurality } }
{ $examples
{ $example
"USING: english io ;"
"14 \"criterion\" ?pluralize print"
"criteria"
}
} ;
HELP: a10n
{ $values { "word" string } { "numeronym" string } }
{ $description "Abbreviates a word of more than three characters, by replacing the inner part of the word with the number of omitted letters. The result is an abbreviation (called a " { $emphasis "numeronym" } ") which is pronounced like the original word." }
{ $notes { $list
$keep-case
"When the input is too short, it is returned unchanged."
{ "The name of this word is " { $snippet "abbreviation" } ", abbreviated by its own strategy." }
{ "This style of abbreviation originated with " { $snippet "i18n" } " (the word " { $emphasis "internationalization" } ") in the 1980s." }
} }
{ $examples
{ $example
"USING: english io ;"
"\"dup\" a10n print"
"dup"
}
{ $example
"USING: english io ;"
"\"abbreviationalism\" a10n print"
"a15m"
}
} ;
HELP: a/an
{ $values { "word" string } { "article" { $or-markup-example "\"a\"" "\"an\"" } } }
{ $description "Gives the proper indefinite singular article (" { $emphasis "a" } " or " { $emphasis "an" } ") for the word. For words which begin with a vowel sound, " { $emphasis "an" } " is used, whereas " { $emphasis "a" } " is used for words which begin with a consonant sound." }
{ $notes "The output does not contain the input. The output of this word is always a singular article, regardless of the plurality of the input." }
{ $examples
{ $example
"USING: english kernel combinators sequences io ;"
"\"object\" [ a/an ] keep \" \" glue print"
"an object"
}
} ;
HELP: ?plural-article
{ $values { "word" string } { "article" { $or-markup-example "\"a\"" "\"an\"" "\"the\"" } } }
{ $description "Output the proper article given the plurality and first letter of the input. Unlike " { $link a/an } " this word handles plural inputs by outputting the definite " { $emphasis "\"the\"" } ". If the input is singular as determined by " { $link singular? } " this word operates like " { $link a/an } "." }
{ $notes { $list "English lacks a plural indefinite article, so the plural definite is used here instead." $keep-case $0-plurality } }
{ $examples
{ $example
"USING: english sequences kernel io ;"
"\"cat\" [ ?plural-article ] keep \" \" glue print"
"a cat"
}
{ $example
"USING: english sequences kernel io ;"
"\"cats\" [ ?plural-article ] keep \" \" glue print"
"the cats"
}
} ;
HELP: comma-list
{ $values
{ "parts" sequence }
{ "conjunction" string }
{ "clause-seq" sequence }
}
{ $description "Generate a comma-separated list of things, emplacing " { $snippet "conjunction" } " before the last " { $snippet "part" } " if there are two or more elements in " { $snippet "parts" } "." }
{ $notes $keep-case }
{ $examples
{ $example
"USING: english io sequences ;"
"{ \"a cat\" \"a peach\" \"an object\" } \"or\" comma-list concat print"
"a cat, a peach, or an object"
}
} ;
HELP: or-markup-example
{ $values { "markup" "a sequence of markup elements" } { "classes" "a sequence of words" } }
{ $description "Used to implement " { $link $or-markup-example } " and demonstrate " { $link comma-list } "." }
{ $examples { "See the examples in " { $link $or-markup-example } "." } } ;
HELP: $or-markup-example
{ $values { "classes" "a sequence of words" } }
{ $description "An example to demonstrate a use-case for " { $link comma-list } ". Works like the " { $link $or } " and " { $link ($instance) } " words from " { $vocab-link "help.markup" } "." }
{ $examples
{ $markup-example
{ $or-markup-example "cat" "octopus" "animal" object pair number array string sequence assoc "bird" } print-element
}
} ;

View File

@ -1,16 +1,130 @@
USE: tools.test
USING: accessors arrays assocs english.private help.markup kernel math
math.parser sequences strings tools.test ;
IN: english
{ "record" } [ "records" singularize ] unit-test
{ "record" } [ "record" singularize ] unit-test
{ "baby" } [ "babies" singularize ] unit-test
{ "baby" } [ "baby" singularize ] unit-test
{ "FOOT" } [ "FEET" singularize ] unit-test
{ "FOOT" } [ "FOOT" singularize ] unit-test
{ "cactus" } [ "cacti" singularize ] unit-test
{ "cactus" } [ "cactuses" singularize ] unit-test
{ "octopus" } [ "octopi" singularize ] unit-test
{ "octopus" } [ "octopuses" singularize ] unit-test
{ "friends" } [ "friend" pluralize ] unit-test
{ "friendlies" } [ "friendly" pluralize ] unit-test
{ "friendlies" } [ "friendlies" pluralize ] unit-test
{ "enemies" } [ "enemy" pluralize ] unit-test
{ "Sheep" } [ "Sheep" pluralize ] unit-test
{ "Moose" } [ "Moose" pluralize ] unit-test
{ "cacti" } [ "cactus" pluralize ] unit-test
{ "octopi" } [ "octopus" pluralize ] unit-test
{ "a10n" } [ "abbreviation" a10n ] unit-test
{ "i18n" } [ "internationalization" a10n ] unit-test
{ t } [ "singular" singular? ] unit-test
{ f } [ "singulars" singular? ] unit-test
{ t } [ "singularity" singular? ] unit-test
{ f } [ "singularities" singular? ] unit-test
{ t } [ "thesis" singular? ] unit-test
{ f } [ "theses" singular? ] unit-test
{ t } [ "goose" singular? ] unit-test
{ t } [ "baby" singular? ] unit-test
{ t } [ "bird" singular? ] unit-test
{ f } [ "birds" singular? ] unit-test
{ t } [ "octopus" singular? ] unit-test
{ f } [ "octopi" singular? ] unit-test
{ t } [ "geese" plural? ] unit-test
{ f } [ "goose" plural? ] unit-test
{ t } [ "birds" plural? ] unit-test
{ f } [ "bird" plural? ] unit-test
{ t } [ "cats" plural? ] unit-test
{ f } [ "cat" plural? ] unit-test
{ t } [ "babies" plural? ] unit-test
{ f } [ "baby" plural? ] unit-test
{ t } [ "octopi" plural? ] unit-test
{ f } [ "octopus" plural? ] unit-test
! they are both singular and plural
{ t } [ "moose" plural? ] unit-test
{ t } [ "moose" singular? ] unit-test
{ t } [ "sheep" plural? ] unit-test
{ t } [ "sheep" singular? ] unit-test
{ "3 babies" } [ 3 "baby" count-of-things ] unit-test
{ "2.5 cats" } [ 2.5 "cat" count-of-things ] unit-test
{ "2.5 CATS" } [ 2.5 "CAT" count-of-things ] unit-test
{ "1 pipe" } [ 1 "pipe" count-of-things ] unit-test
{ "0 pipes" } [ 0 "pipe" count-of-things ] unit-test
{ "babies" } [ 3 "baby" ?pluralize ] unit-test
{ "BABIES" } [ 3 "BABY" ?pluralize ] unit-test
{ "cats" } [ 2.5 "cat" ?pluralize ] unit-test
{ "Cats" } [ 2.5 "Cat" ?pluralize ] unit-test
{ "pipe" } [ 1 "pipe" ?pluralize ] unit-test
{ "pipes" } [ 0 "pipe" ?pluralize ] unit-test
{ "a5s" } [ "address" a10n ] unit-test
{ "a10n" } [ "abbreviation" a10n ] unit-test
{ "l10n" } [ "localization" a10n ] unit-test
{ "i18n" } [ "internationalization" a10n ] unit-test
{ "f28n" } [ "floccinauccinihilipilification" a10n ] unit-test
{ "p43s" } [ "pneumonoultramicroscopicsilicovolcanoconiosis" a10n ] unit-test
{ "a10000c" } [ 10000 CHAR: b <string> "a" "c" surround a10n ] unit-test
{ "an" } [ "object" a/an ] unit-test
{ "an" } [ "elephant" a/an ] unit-test
{ "a" } [ "moose" a/an ] unit-test
{ "a" } [ "xylophone" a/an ] unit-test
{ "the" } [ "objects" ?plural-article ] unit-test
{ "an" } [ "object" ?plural-article ] unit-test
{ "the" } [ "elephants" ?plural-article ] unit-test
{ "an" } [ "elephant" ?plural-article ] unit-test
{ "a" } [ "moose" ?plural-article ] unit-test
{ "a" } [ "goose" ?plural-article ] unit-test
{ "the" } [ "geese" ?plural-article ] unit-test
{ "a" } [ "sheep" ?plural-article ] unit-test
{ { } } [ { } "or" comma-list ] unit-test
{ { "a" } } [ { "a" } "or" comma-list ] unit-test
{ { "a" " or " "b" } }
[ { "a" "b" } "or" comma-list ] unit-test
{ { "a" ", " "b" ", or " "c" } }
[ { "a" "b" "c" } "or" comma-list ] unit-test
{ { "a" ", " "b" ", " "x" ", and " "c" } }
[ { "a" "b" "x" "c" } "and" comma-list ] unit-test
{ {
{ "an " { $link object } } ", "
{ "a " { $link pair } } ", "
{ "a " { $link number } } ", "
{ "an " { $link array } } ", "
{ "a " { $link string } } ", "
{ "a " { $link sequence } } ", or "
{ "an " { $link assoc } }
} } [
{ object pair number array string sequence assoc }
or-markup-example
! an object, a pair, a number, an array, a string, a sequence, or an assoc
] unit-test
{ {
{ "an " { $link object } }
} } [ { object } or-markup-example ] unit-test
{ {
{ "an " { $link object } } " or "
{ "a " { $link pair } }
} } [ { object pair } or-markup-example ] unit-test
{ {
{ "an " { $link object } } ", "
{ "a " { $link pair } } ", or "
{ "a " { $snippet "thing" } }
} } [ { object pair "thing" } or-markup-example ] unit-test

View File

@ -1,7 +1,8 @@
! Copyright (C) 2015 John Benediktsson
! Copyright (C) 2015, 2018 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: assocs assocs.extras combinators formatting kernel literals
locals math math.parser sequences splitting unicode ;
USING: accessors arrays assocs assocs.extras combinators
help.markup kernel literals locals math math.parser sequences
sequences.extras splitting unicode words ;
IN: english
@ -14,6 +15,7 @@ CONSTANT: singular-to-plural H{
! us -> i
{ "alumnus" "alumni" }
{ "cactus" "cacti" }
{ "octopus" "octopi" }
{ "focus" "foci" }
{ "fungus" "fungi" }
{ "nucleus" "nuclei" }
@ -141,11 +143,44 @@ PRIVATE>
[ "s" append ]
} cond match-case ;
: count-of-things ( count word -- str )
over 1 = [ pluralize ] unless "%d %s" sprintf ;
: singular? ( word -- ? )
[ singularize ] [ = ] bi ;
: a10n ( str -- str' )
: plural? ( word -- ? )
[ singularize pluralize ] [ = ] bi ;
: ?pluralize ( count singular -- singular/plural )
swap 1 = [ pluralize ] unless ;
: count-of-things ( count word -- str )
dupd ?pluralize [ number>string ] dip " " glue ;
: a10n ( word -- numeronym )
dup length 3 > [
[ 1 head ] [ length 2 - number>string ] [ 1 tail* ] tri
3append
] when ;
: a/an ( word -- article )
[ first ] [ length ] bi 1 = "afhilmnorsx" "aeiou" ?
member? "an" "a" ? ;
: ?plural-article ( word -- article )
dup singular? [ a/an ] [ drop "the" ] if ;
: comma-list ( parts conjunction -- clause-seq )
[ ", " interleaved ] dip over length dup 3 >= [
[ 3 > ", " " " ? " " surround ] [ 2 - pick set-nth ] bi
] [ 2drop ] if ;
: or-markup-example ( classes -- markup )
[
dup word? [
[ name>> ] keep \ $link
] [
dup \ $snippet
] if swap 2array [ a/an " " append ] dip 2array
] map "or" comma-list ;
: $or-markup-example ( classes -- )
or-markup-example print-element ;

View File

@ -1,4 +0,0 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test fonts ;
IN: fonts.tests

View File

@ -21,11 +21,6 @@ TUPLE: heap { data vector } ;
: <heap> ( class -- heap )
V{ } clone swap boa ; inline
ERROR: not-a-heap object ;
: check-heap ( heap -- heap )
dup heap? [ not-a-heap ] unless ; inline
TUPLE: entry value key heap index ;
: <entry> ( value key heap -- entry )
@ -148,7 +143,6 @@ M: heap heap-pop
[ data-first >entry< ] [ heap-pop* ] bi ;
: slurp-heap ( ... heap quot: ( ... value key -- ... ) -- ... )
[ check-heap ] dip
[ drop '[ _ heap-empty? ] ]
[ '[ _ heap-pop @ ] until ] 2bi ; inline

View File

@ -1,4 +1,4 @@
USING: accessors io.sockets.secure http.client http.client.private http
USING: accessors http http.client http.client.private
io.streams.string kernel namespaces sequences tools.test urls ;
IN: http.client.tests

View File

@ -197,9 +197,9 @@ $nl
ARTICLE: "http.proxy-variables" "HTTP(S) proxy variables"
{ $heading "Proxy Variables" }
"The http and https proxies can be configured per request, or with Factor's dynamic variables, or with the system's environnement variables (searched from left to right) :"
"The http and https proxies can be configured per request, or with Factor's dynamic variables, or with the system's environment variables (searched from left to right) :"
{ $table
{ "variable" "Factor dynamic" "environnement #1" "environnement #2" }
{ "variable" "Factor dynamic" "environment #1" "environment #2" }
{ "HTTP" { $snippet "\"http.proxy\"" } "http_proxy" "HTTP_PROXY" }
{ "HTTPS" { $snippet "\"https.proxy\"" } "https_proxy" "HTTPS_PROXY" }
{ "no proxy" { $snippet "\"no_proxy\"" } "no_proxy" "NO_PROXY" }

View File

@ -1,7 +1,6 @@
USING: accessors assocs continuations http http.server
http.server.requests io.encodings.utf8 io.encodings.binary io.streams.string
kernel math peg sequences tools.test urls ;
IN: http.server.tests
http.server.requests io.encodings.utf8 io.encodings.binary
io.streams.string kernel math peg sequences tools.test urls ;
{ t } [ [ \ + first ] [ <500> ] recover response? ] unit-test

View File

@ -1,4 +1,3 @@
USING: http.server.static tools.test xml.writer ;
IN: http.server.static.tests
{ } [ "resource:basis" directory>html write-xml ] unit-test

View File

@ -1,6 +1,5 @@
USING: kernel tools.test math namespaces prettyprint
sequences inspector io.streams.string ;
IN: inspector.tests
USING: kernel tools.test math namespaces prettyprint sequences
inspector io.streams.string ;
[ 1 2 3 ] describe
f describe

View File

@ -1,4 +1,3 @@
IN: io.crlf.tests
USING: io.crlf tools.test io.streams.string io ;
{ "Hello, world." } [ "Hello, world." [ read-crlf ] with-string-reader ] unit-test

View File

@ -1,6 +1,5 @@
USING: io.directories io.directories.hierarchy kernel
sequences tools.test ;
IN: io.directories.hierarchy.tests
{ { "classes/tuple/tuple.factor" } } [
"resource:core" [

View File

@ -74,7 +74,7 @@ PRIVATE>
: find-file ( path quot: ( ... name -- ... ? ) -- path/f )
[ bfs? <directory-iterator> ] dip
[ keep and ] curry iterate-directory ; inline
'[ _ keep and ] iterate-directory ; inline
: find-files ( path quot: ( ... name -- ... ? ) -- paths )
selector [ each-file ] dip ; inline

View File

@ -1,7 +1,6 @@
USING: io.encodings.string io.encodings.8-bit
io.encodings.8-bit.private tools.test strings arrays
io.encodings.8-bit.latin1 io.encodings.8-bit.windows-1252 ;
IN: io.encodings.8-bit.tests
{ B{ char: f char: o char: o } } [ "foo" latin1 encode ] unit-test
[ { 256 } >string latin1 encode ] must-fail

View File

@ -1,7 +1,6 @@
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: io.encodings.gb18030 io.encodings.string strings tools.test arrays ;
IN: io.encodings.gb18030.tests
{ "hello" } [ "hello" gb18030 encode >string ] unit-test
{ "hello" } [ "hello" gb18030 decode ] unit-test

View File

@ -1,6 +1,5 @@
USING: io.encodings.strict io.encodings.ascii tools.test
arrays io.encodings.string ;
IN: io.encodings.strict.tests
{ { 0xfffd } } [ { 128 } ascii decode >array ] unit-test
[ { 128 } ascii strict decode ] must-fail

View File

@ -2,7 +2,6 @@
! See http://factorcode.org/license.txt for BSD license.
USING: strings io.encodings.utf8 io.encodings.utf16
io.encodings.string tools.test io.encodings.binary ;
IN: io.encodings.string.tests
{ "hello" } [ "hello" utf8 decode ] unit-test
{ B{ 0 1 22 255 } } [ B{ 0 1 22 255 } binary decode ] unit-test

View File

@ -3,7 +3,6 @@
USING: kernel tools.test io.encodings.utf32 arrays sbufs
io.streams.byte-array sequences io.encodings io strings
io.encodings.string alien.c-types alien.strings accessors classes ;
IN: io.encodings.utf32.tests
{ { char: x } } [ B{ 0 0 0 char: x } utf32be decode >array ] unit-test
{ { 0x1D11E } } [ B{ 0 1 0xD1 0x1E } utf32be decode >array ] unit-test

View File

@ -1,6 +1,5 @@
USING: io.encodings.string io.encodings.utf7 kernel sequences strings
tools.test ;
IN: io.encodings.utf7.tests
{
{

View File

@ -1,7 +1,6 @@
USING: io.files.info io.encodings.utf8 io.files
io.directories kernel io.pathnames accessors tools.test
sequences io.files.temp ;
IN: io.files.info.tests
{ "hi41" } [
[

View File

@ -1,7 +1,6 @@
! Copyright (C) 2015 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test io.files.info.unix.linux ;
IN: io.files.info.unix.linux.tests
[ "/media/erg/4TB D" ]
[ "/media/erg/4TB\\040D" decode-mount-point ] unit-test

View File

@ -1,6 +1,5 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test io.files.info.windows system kernel ;
IN: io.files.info.windows.tests
[ ] [ vm-path file-times 3drop ] unit-test

View File

@ -2,7 +2,6 @@ USING: accessors continuations io.directories
io.directories.hierarchy io.encodings.ascii io.files
io.files.info io.files.temp io.files.unique io.pathnames kernel
namespaces sequences strings tools.test ;
IN: io.files.unique.tests
{ 123 } [
[

View File

@ -4,7 +4,6 @@ USING: combinators continuations io.backend io.directories io.files
io.files.temp io.files.windows io.pathnames kernel kernel.private libc
literals memory sequences splitting tools.test windows.kernel32
io.files.unique destructors ;
IN: io.files.windows.tests
[ f ] [ "\\foo" absolute-path? ] unit-test
[ t ] [ "\\\\?\\c:\\foo" absolute-path? ] unit-test

View File

@ -1,9 +1,7 @@
USING: io io.pipes io.streams.string io.encodings.utf8
io.encodings.binary io.streams.duplex io.encodings io.timeouts
namespaces continuations tools.test kernel calendar destructors
accessors debugger math sequences threads
concurrency.count-downs fry ;
IN: io.pipes.tests
USING: accessors calendar concurrency.count-downs continuations
destructors fry io io.encodings io.encodings.binary
io.encodings.utf8 io.pipes io.streams.duplex io.streams.string
io.timeouts kernel math namespaces threads tools.test ;
{ "Hello" } [
utf8 <pipe> [

View File

@ -1,6 +1,5 @@
USING: tools.test io.pipes io.pipes.unix io.encodings.utf8
io.encodings io namespaces sequences ;
IN: io.pipes.unix.tests
[ { 0 0 } ] [ { "ls" "grep ." } run-pipeline ] unit-test

View File

@ -34,7 +34,7 @@ HELP: secure-config
HELP: <secure-config>
{ $values { "config" secure-config } }
{ $description "Creates a new secure socket configration with default values." } ;
{ $description "Creates a new secure socket configuration with default values." } ;
ARTICLE: "ssl-key-file" "The key file and password"
"The " { $snippet "key-file" } " and " { $snippet "password" } " slots of a " { $link secure-config } " can be set to a private key file in PEM format. These slots are required for secure servers, and also for clients when client-side authentication is used." ;

View File

@ -1,6 +1,5 @@
IN: io.sockets.secure.tests
USING: accessors io.sockets io.sockets.secure io.sockets.secure.debug
kernel system tools.test ;
USING: accessors io.sockets io.sockets.secure
io.sockets.secure.debug kernel system tools.test ;
{ "hello" 24 } [ "hello" 24 <inet> "hello" <secure> [ host>> ] [ port>> ] bi ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2011 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: io.standard-paths io.standard-paths.macosx tools.test ;
IN: io.standard-paths.macosx.tests
{ "/System/Library/CoreServices/Finder.app" }
[ "com.apple.finder" find-native-bundle ] unit-test

View File

@ -1,4 +0,0 @@
! Copyright (C) 2011 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test io.standard-paths ;
IN: io.standard-paths.tests

View File

@ -1,7 +1,5 @@
USING: kernel sequences tools.test ;
IN: ip-parser
USING: ip-parser kernel sequences tools.test ;
{ "0.0.0.1" } [ "1" normalize-ipv4 ] unit-test
{ "1.0.0.2" } [ "1.2" normalize-ipv4 ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2016 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: io.streams.string json.prettyprint json.reader tools.test ;
IN: json.prettyprint.tests
[
"{

View File

@ -1,6 +1,5 @@
USING: hashtables io.streams.string json json.reader
json.reader.private kernel literals math strings tools.test ;
IN: json.reader.tests
{ f } [ "false" json> ] unit-test
{ t } [ "true" json> ] unit-test

View File

@ -2,7 +2,6 @@
! See http://factorcode.org/license.txt for BSD license.
USING: lcs lcs.diff2html kernel tools.test strings sequences
xml.writer ;
IN: lcs.diff2html.tests
{ } [
"hello" "heyo" [ [ 1string ] { } map-as ] bi@

View File

@ -1,4 +1,3 @@
IN: libc.tests
USING: destructors kernel libc libc.private namespaces
tools.test ;

View File

@ -2,7 +2,6 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs kernel linked-assocs math sequences
tools.test ;
IN: linked-assocs.tests
{ { 1 2 3 } } [
<linked-hash> 1 "b" pick set-at

View File

@ -1,6 +1,5 @@
USING: arrays kernel math math.combinatorics
math.combinatorics.private tools.test sequences ;
IN: math.combinatorics.tests
{ 1 } [ -1 factorial ] unit-test ! required by other math.combinatorics words
{ 1 } [ 0 factorial ] unit-test

View File

@ -1,5 +1,4 @@
USING: fry kernel sequences tools.test ;
IN: math.primes.erato.fast
USING: fry kernel math.primes.erato.fast sequences tools.test ;
{

View File

@ -11,7 +11,7 @@ IN: math.primes.erato.fast
CONSTANT: wheel-2-3-5-7 $[
11 dup 210 + [a,b] [
{ 2 3 5 7 } [ divisor? ] with any? not
{ 2 3 5 7 } [ divisor? ] with none?
] B{ } filter-as differences
]

View File

@ -1,7 +1,6 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test math.primes.lucas-lehmer ;
IN: math.primes.lucas-lehmer.tests
{ t } [ 2 lucas-lehmer ] unit-test
{ t } [ 3 lucas-lehmer ] unit-test

View File

@ -1,5 +1,4 @@
USING: kernel math.primes.miller-rabin sequences tools.test ;
IN: math.primes.miller-rabin.tests
{ f } [ 473155932665450549999756893736999469773678960651272093993257221235459777950185377130233556540099119926369437865330559863 miller-rabin ] unit-test
{ t } [ 2 miller-rabin ] unit-test

View File

@ -18,9 +18,9 @@ IN: math.primes.miller-rabin
] [
r <iota> [
2^ s * a swap n ^mod n-1 =
] any? not
] none?
] if
] any? not ;
] none? ;
PRIVATE>

View File

@ -1,6 +1,5 @@
USING: arrays kernel math math.primes math.primes.miller-rabin
sequences tools.test ;
IN: math.primes.tests
{ 1237 } [ 1234 next-prime ] unit-test
{ f t } [ 1234 prime? 1237 prime? ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: math.primes.safe math.primes.safe.private tools.test ;
IN: math.primes.safe.tests
{ 863 } [ 862 next-safe-prime ] unit-test
{ f } [ 862 safe-prime? ] unit-test

View File

@ -1,7 +1,6 @@
USING: arrays assocs kernel math math.functions math.statistics sequences
math.order tools.test math.vectors ;
FROM: math.ranges => [a,b] ;
IN: math.statistics.tests
{ 3 } [ { 1 2 3 4 5 } 1 power-mean ] unit-test
{ t } [ { 1 2 3 4 5 } [ 2 power-mean ] [ quadratic-mean ] bi 1e-10 ~ ] unit-test

View File

@ -13,7 +13,7 @@ HELP: mime-type
{ $values
{ "filename" "a filename" }
{ "mime-type" "a MIME type string" } }
{ $description "Outputs the MIME type associtated with a path by parsing the path's file extension and looking it up in the table returned by " { $link mime-types } "." } ;
{ $description "Outputs the MIME type associated with a path by parsing the path's file extension and looking it up in the table returned by " { $link mime-types } "." } ;
HELP: mime-types
{ $values

View File

@ -1,4 +1,3 @@
IN: mime.types.tests
USING: mime.types tools.test ;
{ "application/postscript" } [ "foo.ps" mime-type ] unit-test

View File

@ -1,6 +1,5 @@
USING: arrays generic kernel math models namespaces sequences assocs
tools.test models.arrow accessors ;
IN: models.arrow.tests
3 <model> "x" set
"x" get [ 2 * ] <arrow> dup "z" set

View File

@ -1,4 +1,3 @@
IN: models.arrows.smart.tests
USING: models.arrow.smart tools.test accessors models math kernel ;
{ 7 } [ 3 <model> 4 <model> [ + ] <smart-arrow> [ activate-model ] [ value>> ] bi ] unit-test

View File

@ -1,6 +1,5 @@
USING: arrays generic kernel math models namespaces sequences assocs
tools.test models.mapping accessors make ;
IN: models.mapping.tests
! Test mapping
{ } [

View File

@ -0,0 +1,52 @@
USING: help.markup help.syntax strings ;
IN: multiline
HELP: STRING:
{ $syntax "STRING: name\nfoo\n;" }
{ $description "Forms a multiline string literal, or 'here document' stored in the word called name. A semicolon is used to signify the end, and that semicolon must be on a line by itself, not preceded or followed by any whitespace. The string will have newlines in between lines but not at the end, unless there is a blank line before the semicolon." } ;
HELP: /*
{ $syntax "/* comment */" }
{ $description "Provides C-like comments that can span multiple lines. One caveat is that " { $snippet "/*" } " and " { $snippet "*/" } " are still tokens and must not appear in the comment text itself." }
{ $examples
{ $example "USING: multiline ;"
"/* I think that I shall never see"
" A poem lovely as a tree. */"
""
}
} ;
HELP: HEREDOC:
{ $syntax "HEREDOC: marker\n...text...\nmarker" }
{ $values { "marker" "a word (token)" } { "text" "arbitrary text" } { "value" string } }
{ $description "Returns a string delimited by an arbitrary user-defined token. This delimiter must be exactly the text beginning at the first non-blank character after " { $link POSTPONE: HEREDOC: } " until the end of the line containing " { $link POSTPONE: HEREDOC: } ". Text is captured until a line is found containing exactly this delimiter string." }
{ $warning "Whitespace is significant." }
{ $examples
{ $example "USING: multiline prettyprint ;"
"HEREDOC: END\nx\nEND\n."
"\"x\\n\""
}
{ $example "USING: multiline prettyprint sequences ;"
"2 5 HEREDOC: zap\nfoo\nbar\nzap\nsubseq ."
"\"o\\nb\""
}
} ;
HELP: parse-multiline-string
{ $values { "end-text" "a string delineating the end" } { "str" "the parsed string" } }
{ $description "Parses the input stream until the " { $snippet "end-text" } " is reached and returns the parsed text as a string." }
{ $notes "Used to implement " { $link POSTPONE: /* } "." } ;
ARTICLE: "multiline" "Multiline"
"Multiline strings:"
{ $subsections
POSTPONE: STRING:
POSTPONE: HEREDOC:
}
"Multiline comments:"
{ $subsections POSTPONE: /* }
"Writing new multiline parsing words:"
{ $subsections parse-multiline-string }
;
ABOUT: "multiline"

View File

@ -1,4 +1,3 @@
IN: nmake.tests
USING: nmake kernel tools.test ;
{ } [ [ ] { } nmake ] unit-test

View File

@ -1,5 +1,4 @@
USING: arrays continuations debugger io.streams.string peg tools.test ;
IN: peg.debugger.tests
{ "Peg parsing error at character position 0.\nExpected 'A' or 'B'\nGot 'xxxx'\n" } [
[ "xxxx" "A" token "B" token 2array choice parse ] [ ] recover

View File

@ -425,7 +425,7 @@ M: ebnf-sequence build-locals ( code ast -- code )
elements>> filter-hidden dup length 1 = [
first build-locals
] [
dup [ ebnf-var? ] any? not [
dup [ ebnf-var? ] none? [
drop
] [
[

View File

@ -1,4 +1,3 @@
IN: porter-stemmer.tests
USING: arrays assocs io kernel porter-stemmer sequences
tools.test io.files io.encodings.utf8 ;

View File

@ -1,7 +1,6 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test quoting ;
IN: quoting.tests
{ f } [ "" quoted? ] unit-test
{ t } [ "''" quoted? ] unit-test

View File

@ -1,5 +1,4 @@
USING: sorting.human tools.test sorting.slots sorting ;
IN: sorting.human.tests
{ { "x1y" "x2" "x10y" } }
[ { "x1y" "x10y" "x2" } { human<=> } sort-by ] unit-test

View File

@ -1,4 +1,5 @@
IN: sorting.insertion
USING: sorting.insertion sequences kernel tools.test ;
{ { { 1 1 } { 1 2 } { 2 0 } } } [ { { 2 0 } { 1 1 } { 1 2 } } dup [ first ] insertion-sort ] unit-test
{ { { 1 1 } { 1 2 } { 2 0 } } } [
{ { 2 0 } { 1 1 } { 1 2 } } dup [ first ] insertion-sort
] unit-test

View File

@ -1,4 +1,3 @@
IN: soundex.tests
USING: soundex tools.test ;
{ "S162" } [ "supercalifrag" soundex ] unit-test

View File

@ -1,5 +1,5 @@
IN: splitting.monotonic
USING: tools.test math arrays kernel sequences ;
USING: tools.test math arrays kernel sequences
splitting.monotonic ;
{ { } } [ { } [ < ] monotonic-split ] unit-test
{ { { 1 } } } [ { 1 } [ < ] monotonic-split ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test strings.tables ;
IN: strings.tables.tests
{ { } } [ { } format-table ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2008 Marc Fauconneau.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test suffix-arrays kernel namespaces sequences ;
IN: suffix-arrays.tests
! built from [ all-words 10 head [ name>> ] map ]
{ } [

View File

@ -1,6 +1,5 @@
USING: system-info.linux strings splitting sequences
tools.test kernel ;
IN: system-info.linux.tests
[ 6 ] [ uname length ] unit-test

View File

@ -1,6 +1,5 @@
USING: math math.order strings system-info.windows tools.test
system-info ;
IN: system-info.windows.tests
[ t ] [ cpus integer? ] unit-test
[ t ] [ username string? ] unit-test

View File

@ -1,7 +1,6 @@
USING: timers timers.private calendar concurrency.count-downs
concurrency.promises fry kernel math math.order sequences
threads tools.test tools.time ;
IN: timers.tests
{ } [
1 <count-down>

View File

@ -71,7 +71,7 @@ SINGLETON: deprecation-observer
M: deprecation-observer definitions-changed
drop filter-word-defs
dup [ deprecated? ] any? not
dup [ deprecated? ] none?
[ [ check-deprecations ] each ]
[ drop initialize-deprecation-notes ] if ;

View File

@ -2,7 +2,6 @@
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test math kernel sets generic
ui.baseline-alignment ui.baseline-alignment.private ;
IN: ui.baseline-alignment.tests
! Test baseline calculations
{ 10 0 } [ 0 10 0 10 combine-metrics ] unit-test

View File

@ -1,4 +1,3 @@
IN: ui.gadgets.borders.tests
USING: accessors kernel math.rectangles namespaces tools.test
ui.gadgets ui.gadgets.borders ui.gadgets.borders.private
ui.gadgets.editors ;

View File

@ -1,6 +1,5 @@
USING: accessors kernel models namespaces tools.test ui.gadgets
ui.gadgets.buttons ;
IN: ui.gadgets.buttons.tests
{ } [
2 <model> {

View File

@ -1,4 +1,3 @@
IN: ui.gadgets.canvas.tests
USING: ui.gadgets.canvas tools.test kernel ;
{ 1 0 } [ [ drop ] draw-canvas ] must-infer-as

View File

@ -1,4 +0,0 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test ui.gadgets.debug ;
IN: ui.gadgets.debug.tests

View File

@ -3,7 +3,6 @@ tools.test kernel io io.streams.plain definitions namespaces
ui.gadgets ui.gadgets.grids prettyprint documents ui.gestures
ui.gadgets.debug models documents.elements ui.gadgets.scrollers
ui.gadgets.line-support sequences ;
IN: ui.gadgets.editors.tests
{ "foo bar" } [
<editor> "editor" set

View File

@ -1,6 +1,5 @@
USING: accessors kernel namespaces tools.test ui.gadgets
ui.gadgets.frames ui.gadgets.grids ui.gadgets.labels ;
IN: ui.gadgets.frames.tests
{ } [ 3 3 <frame> { 1 1 } >>filled-cell layout ] unit-test

View File

@ -1,4 +1,3 @@
IN: ui.gadgets.glass.tests
USING: tools.test ui.gadgets.glass ui.gadgets.worlds ui.gadgets
math.rectangles namespaces accessors models sequences arrays ;

View File

@ -1,6 +1,5 @@
USING: accessors colors.constants sequences tools.test
ui.gadgets ui.gadgets.labeled ;
IN: ui.gadgets.labeled.tests
{ t } [
<gadget> "Hey" <labeled-gadget> content>> gadget?

View File

@ -1,5 +1,4 @@
USING: accessors tools.test ui.gadgets ui.gadgets.labels ;
IN: ui.gadgets.labels.tests
{ { 119 14 } } [
<gadget> { 100 14 } >>dim

View File

@ -36,7 +36,7 @@ HELP: line-gadget
HELP: pref-viewport-dim*
{ $values { "gadget" line-gadget } { "dim" array } }
{ $description "Calculates the preferred viewport dimenstions of the line gadget." }
{ $description "Calculates the preferred viewport dimensions of the line gadget." }
{ $see-also pref-viewport-dim } ;
ARTICLE: "ui.gadgets.line-support" "Gadget line support"

View File

@ -2,7 +2,6 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays kernel tools.test ui.gadgets.editors
ui.gadgets.line-support ui.gadgets.line-support.private ui.text ;
IN: ui.gadgets.line-support.tests
! line-gadget-height
{ t } [

Some files were not shown because too many files have changed in this diff Show More