math.rectangles: add infinite recursion check in case somebody does something stupid
parent
b3c5097862
commit
04be762fac
|
@ -1,7 +1,11 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors math.rectangles kernel prettyprint.custom prettyprint.backend ;
|
USING: accessors math.rectangles kernel prettyprint.custom prettyprint.backend ;
|
||||||
IN: math.rectangles.prettyprint
|
IN: math.rectangles.prettyprint
|
||||||
|
|
||||||
M: rect pprint*
|
M: rect pprint*
|
||||||
\ RECT: [ [ loc>> ] [ dim>> ] bi [ pprint* ] bi@ ] pprint-prefix ;
|
[
|
||||||
|
\ RECT: [
|
||||||
|
[ loc>> ] [ dim>> ] bi [ pprint* ] bi@
|
||||||
|
] pprint-prefix
|
||||||
|
] check-recursion ;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: tools.test math.rectangles ;
|
USING: tools.test math.rectangles prettyprint io.streams.string
|
||||||
|
kernel accessors ;
|
||||||
IN: math.rectangles.tests
|
IN: math.rectangles.tests
|
||||||
|
|
||||||
[ RECT: { 10 10 } { 20 20 } ]
|
[ RECT: { 10 10 } { 20 20 } ]
|
||||||
|
@ -40,3 +41,6 @@ IN: math.rectangles.tests
|
||||||
{ 30 30 }
|
{ 30 30 }
|
||||||
} rect-containing
|
} rect-containing
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Prettyprint for RECT: didn't do nesting check properly
|
||||||
|
[ ] [ [ RECT: f f dup >>dim . ] with-string-writer drop ] unit-test
|
||||||
|
|
Loading…
Reference in New Issue