Added documentation and tests for new words

db4
Alfredo Beaumont 2008-07-13 18:33:37 +02:00
parent f05aabdf28
commit a10fc1e00e
2 changed files with 59 additions and 3 deletions

View File

@ -1,4 +1,4 @@
USING: help.syntax help.markup kernel prettyprint sequences strings ;
USING: help.syntax help.markup kernel prettyprint sequences strings words math ;
IN: ctags
ARTICLE: "ctags" "Ctags file"
@ -6,7 +6,10 @@ ARTICLE: "ctags" "Ctags file"
{ $subsection ctags }
{ $subsection ctags-write }
{ $subsection ctag-strings }
{ $subsection ctag } ;
{ $subsection ctag }
{ $subsection ctag-word }
{ $subsection ctag-path }
{ $subsection ctag-lineno } ;
HELP: ctags ( path -- )
{ $values { "path" "a pathname string" } }
@ -57,4 +60,41 @@ HELP: ctag ( seq -- str )
}
} ;
HELP: ctag-lineno ( ctag -- n )
{ $values { "ctag" sequence }
{ "n" integer } }
{ $description "Provides de line number " { $snippet "n" } " from a sequence in ctag format " }
{ $examples
{ $example
"USING: kernel ctags prettyprint ;"
"{ if { \"resource:extra/unix/unix.factor\" 91 } } ctag-lineno ."
"91"
}
} ;
HELP: ctag-path ( ctag -- path )
{ $values { "ctag" sequence }
{ "path" string } }
{ $description "Provides a path string " { $snippet "path" } " from a sequence in ctag format" }
{ $examples
{ $example
"USING: kernel ctags prettyprint ;"
"{ if { \"resource:extra/unix/unix.factor\" 91 } } ctag-path ."
"\"resource:extra/unix/unix.factor\""
}
} ;
HELP: ctag-word ( ctag -- word )
{ $values { "ctag" sequence }
{ "word" word } }
{ $description "Provides the " { $snippet "word" } " from a sequence in ctag format " }
{ $examples
{ $example
"USING: kernel ctags prettyprint ;"
"{ if { \"resource:extra/unix/unix.factor\" 91 } } ctag-word ."
"if"
}
} ;
ABOUT: "ctags"

View File

@ -1,6 +1,21 @@
USING: kernel ctags tools.test io.backend sequences arrays prettyprint ;
IN: ctags.tests
[ t ] [
91
{ { if { "resource:extra/unix/unix.factor" 91 } } } ctag-lineno =
] unit-test
[ t ] [
"resource:extra/unix/unix.factor"
{ { if { "resource:extra/unix/unix.factor" 91 } } } ctag-path =
] unit-test
[ t ] [
if
{ { if { "resource:extra/unix/unix.factor" 91 } } } ctag-word =
] unit-test
[ t ] [
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append
{ if { "resource:extra/unix/unix.factor" 91 } } ctag =
@ -9,4 +24,5 @@ IN: ctags.tests
[ t ] [
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append 1array
{ { if { "resource:extra/unix/unix.factor" 91 } } } ctag-strings =
] unit-test
] unit-test