| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | USING: documents documents.private accessors sequences | 
					
						
							|  |  |  | namespaces tools.test make arrays kernel fry ;
 | 
					
						
							| 
									
										
										
										
											2009-08-13 20:21:44 -04:00
										 |  |  | IN: documents.tests | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Tests | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { } } [ | 
					
						
							| 
									
										
										
										
											2008-12-02 21:46:09 -05:00
										 |  |  |     [ | 
					
						
							|  |  |  |         { 1 10 } | 
					
						
							|  |  |  |         { 1 10 } [ , "HI" , ] each-line
 | 
					
						
							|  |  |  |     ] { } make | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { 1 "HI" } } [ | 
					
						
							| 
									
										
										
										
											2008-12-02 21:46:09 -05:00
										 |  |  |     [ | 
					
						
							|  |  |  |         { 1 10 } | 
					
						
							|  |  |  |         { 1 11 } [ , "HI" , ] each-line
 | 
					
						
							|  |  |  |     ] { } make | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { 1 "HI" 2 "HI" } } [ | 
					
						
							| 
									
										
										
										
											2008-12-02 21:46:09 -05:00
										 |  |  |     [ | 
					
						
							|  |  |  |         { 1 10 } | 
					
						
							|  |  |  |         { 2 11 } [ , "HI" , ] each-line
 | 
					
						
							|  |  |  |     ] { } make | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { { t f 1 } { t f 2 } } } [ | 
					
						
							| 
									
										
										
										
											2008-12-02 21:46:09 -05:00
										 |  |  |     [ | 
					
						
							|  |  |  |         { 1 10 } { 2 11 } | 
					
						
							|  |  |  |         t f
 | 
					
						
							|  |  |  |         '[ [ _ _ ] dip 3array , ] each-line
 | 
					
						
							|  |  |  |     ] { } make | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { 10 4 } } [ { "a" } { 10 3 } text+loc ] unit-test | 
					
						
							|  |  |  | { { 10 4 } } [ { "a" } { 10 3 } text+loc ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { 2 9 } } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     { 10 0 } "doc" get validate-loc | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { 1 12 } } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     { 1 20 } "doc" get validate-loc | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { " world,\nhow are you?\nMore" } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     { 0 5 } { 2 4 } "doc" get doc-range | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Hello world,\nhow you?\nMore text" } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     { 1 3 } { 1 7 } "doc" get remove-doc-range | 
					
						
							|  |  |  |     "doc" get doc-string | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Hello world,\nhow text" } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     { 1 3 } { 2 4 } "doc" get remove-doc-range | 
					
						
							|  |  |  |     "doc" get doc-string | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Hello world,\nhow you?\nMore text" } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     "" { 1 3 } { 1 7 } "doc" get set-doc-range | 
					
						
							|  |  |  |     "doc" get doc-string | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Hello world,\nhow text" } [ | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  |     <document> "doc" set
 | 
					
						
							|  |  |  |     "Hello world,\nhow are you?\nMore text" | 
					
						
							|  |  |  |     "doc" get set-doc-string | 
					
						
							|  |  |  |     "" { 1 3 } { 2 4 } "doc" get set-doc-range | 
					
						
							|  |  |  |     "doc" get doc-string | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-16 02:03:34 -05:00
										 |  |  | <document> "doc" set
 | 
					
						
							|  |  |  | "Hello\nworld, how are\nyou?" "doc" get set-doc-string | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { 2 4 } } [ "doc" get doc-end ] unit-test | 
					
						
							| 
									
										
										
										
											2009-02-16 02:03:34 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | ! Undo/redo | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ <document> "d" set ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "Hello, world." "d" get set-doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  |     T{ edit | 
					
						
							|  |  |  |        { old-string "" } | 
					
						
							|  |  |  |        { new-string "Hello, world." } | 
					
						
							|  |  |  |        { from { 0 0 } } | 
					
						
							|  |  |  |        { old-to { 0 0 } } | 
					
						
							|  |  |  |        { new-to { 0 13 } } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | } [ "d" get undos>> first ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "Goodbye" { 0 0 } { 0 5 } "d" get set-doc-range ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Goodbye, world." } [ "d" get doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "cruel " { 0 9 } { 0 9 } "d" get set-doc-range ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { 3 } [ "d" get undos>> length ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Goodbye, cruel world." } [ "d" get doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "" { 0 9 } { 0 15 } } [ | 
					
						
							| 
									
										
										
										
											2009-05-25 17:38:33 -04:00
										 |  |  |     "d" get undos>> last
 | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  |     [ old-string>> ] [ from>> ] [ new-to>> ] tri
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "d" get undo ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Goodbye, world." } [ "d" get doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "d" get undo ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Hello, world." } [ "d" get doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "d" get redo ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 01:30:30 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Goodbye, world." } [ "d" get doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 13:11:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ <document> "d" set ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 13:11:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "d" get clear-doc ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 13:11:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "d" get clear-doc ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-28 13:11:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { 0 } [ "d" get undos>> length ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-29 04:04:23 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ <document> "d" set ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-29 04:04:23 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "d" get value>> "value" set ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-29 04:04:23 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ "Hello world" "d" get set-doc-string ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-29 04:04:23 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { { "" } } [ "value" get ] unit-test |