From a10fc1e00e9298c4c0dffa542a54cd0959b4b3ed Mon Sep 17 00:00:00 2001 From: Alfredo Beaumont Date: Sun, 13 Jul 2008 18:33:37 +0200 Subject: [PATCH] Added documentation and tests for new words --- extra/ctags/ctags-docs.factor | 44 ++++++++++++++++++++++++++++++++-- extra/ctags/ctags-tests.factor | 18 +++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/extra/ctags/ctags-docs.factor b/extra/ctags/ctags-docs.factor index 22d811ad3f..32f3e05c6e 100644 --- a/extra/ctags/ctags-docs.factor +++ b/extra/ctags/ctags-docs.factor @@ -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" \ No newline at end of file diff --git a/extra/ctags/ctags-tests.factor b/extra/ctags/ctags-tests.factor index 6c73b58ecb..700b897657 100644 --- a/extra/ctags/ctags-tests.factor +++ b/extra/ctags/ctags-tests.factor @@ -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 \ No newline at end of file +] unit-test +