If a vocab fails to load, manifest would be left in a weird state (reported by Joe Groff)

Slava Pestov 2009-05-22 01:59:50 -05:00
parent 661e2a0994
commit 10f86331b4
4 changed files with 17 additions and 3 deletions

View File

@ -619,3 +619,12 @@ EXCLUDE: qualified.tests.bar => x ;
[ [
"USE: kernel UNUSE: kernel dup" <string-reader> "unuse-test" parse-stream "USE: kernel UNUSE: kernel dup" <string-reader> "unuse-test" parse-stream
] [ error>> error>> error>> no-word-error? ] must-fail-with ] [ error>> error>> error>> no-word-error? ] must-fail-with
[ ] [ [ "vocabs.loader.test.l" forget-vocab ] with-compilation-unit ] unit-test
[
[ "vocabs.loader.test.l" use-vocab ] must-fail
[ f ] [ "vocabs.loader.test.l" manifest get search-vocab-names>> key? ] unit-test
[ ] [ "vocabs.loader.test.l" unuse-vocab ] unit-test
[ f ] [ "vocabs.loader.test.l" manifest get search-vocab-names>> key? ] unit-test
] with-file-vocabs

View File

@ -0,0 +1,4 @@
IN: vocabs.loader.test.l
USE: kernel
"Oops" throw

View File

@ -0,0 +1 @@
unportable

View File

@ -108,8 +108,8 @@ TUPLE: no-current-vocab ;
dup using-vocab? dup using-vocab?
[ vocab-name "Already using ``" "'' vocabulary" surround note. ] [ [ vocab-name "Already using ``" "'' vocabulary" surround note. ] [
manifest get manifest get
[ [ vocab-name ] dip search-vocab-names>> conjoin ]
[ [ load-vocab ] dip search-vocabs>> push ] [ [ load-vocab ] dip search-vocabs>> push ]
[ [ vocab-name ] dip search-vocab-names>> conjoin ]
2bi 2bi
] if ; ] if ;
@ -121,8 +121,8 @@ TUPLE: no-current-vocab ;
: unuse-vocab ( vocab -- ) : unuse-vocab ( vocab -- )
dup using-vocab? [ dup using-vocab? [
manifest get manifest get
[ [ vocab-name ] dip search-vocab-names>> delete-at ]
[ [ load-vocab ] dip search-vocabs>> delq ] [ [ load-vocab ] dip search-vocabs>> delq ]
[ [ vocab-name ] dip search-vocab-names>> delete-at ]
2bi 2bi
] [ drop ] if ; ] [ drop ] if ;