diff --git a/core/vocabs/vocabs-tests.factor b/core/vocabs/vocabs-tests.factor index 21c3668148..ec486e3a5a 100644 --- a/core/vocabs/vocabs-tests.factor +++ b/core/vocabs/vocabs-tests.factor @@ -3,3 +3,11 @@ USING: vocabs tools.test ; IN: vocabs.tests [ f ] [ "kernel" vocab-main ] unit-test + +[ t ] [ "" "" child-vocab? ] unit-test +[ t ] [ "" "io.files" child-vocab? ] unit-test +[ t ] [ "io" "io.files" child-vocab? ] unit-test +[ f ] [ "io.files" "io" child-vocab? ] unit-test + +[ t ] [ "io.files" "io" parent-vocab? ] unit-test +[ f ] [ "io" "io.files" parent-vocab? ] unit-test diff --git a/core/vocabs/vocabs.factor b/core/vocabs/vocabs.factor index 38881673e9..f023472c68 100644 --- a/core/vocabs/vocabs.factor +++ b/core/vocabs/vocabs.factor @@ -111,6 +111,12 @@ ERROR: no-vocab name ; : child-vocabs ( vocab -- seq ) vocab-name vocabs [ child-vocab? ] with filter ; +: parent-vocab? ( suffix name -- ? ) + swap child-vocab? ; + +: parent-vocabs ( vocab -- seq ) + vocab-name vocabs [ parent-vocab? ] with filter ; + GENERIC: >vocab-link ( name -- vocab ) M: vocab-spec >vocab-link ;