| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  | USING: continuations xml xml.errors tools.test kernel arrays | 
					
						
							| 
									
										
										
										
											2009-03-18 19:32:34 -04:00
										 |  |  | xml.data quotations fry byte-arrays ;
 | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | IN: xml.errors.tests | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : xml-error-test ( expected-error xml-string -- )
 | 
					
						
							| 
									
										
										
										
											2008-12-02 20:59:16 -05:00
										 |  |  |     '[ _ string>xml ] swap '[ _ = ] must-fail-with ;
 | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | T{ no-entity f 1 10 "nbsp" } "<x> </x>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-29 22:41:08 -05:00
										 |  |  | T{ mismatched f 1 7 T{ name f "" "x" "" } T{ name f "" "y" "" } } | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  |     "<x></y>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-29 22:41:08 -05:00
										 |  |  | T{ unclosed f 1 3 V{ T{ name f "" "x" "" } } } "<x>" xml-error-test | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | T{ nonexist-ns f 1 5 "x" } "<x:y/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-29 22:41:08 -05:00
										 |  |  | T{ unopened f 1 4 } "</x>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  | T{ not-yes/no f 1 41 "maybe" } | 
					
						
							|  |  |  |     "<?xml version='1.0' standalone='maybe'?><x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2013-03-27 13:04:58 -04:00
										 |  |  | T{ extra-attrs f 1 32 { T{ name f "" "foo" f } } | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | } "<?xml version='1.1' foo='bar'?><x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  | T{ bad-version f 1 28 "5 million" } | 
					
						
							|  |  |  |     "<?xml version='5 million'?><x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2008-07-06 00:08:30 -04:00
										 |  |  | T{ notags f } "" xml-error-test | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | T{ multitags } "<x/><y/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-29 22:41:08 -05:00
										 |  |  | T{ bad-prolog  f 1 25 T{ prolog f "1.0" "UTF-8" f } } | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  |     "<x/><?xml version='1.0'?>" xml-error-test | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | T{ capitalized-prolog f 1 6 "XmL" } "<?XmL version='1.0'?><x/>" | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  |     xml-error-test | 
					
						
							| 
									
										
										
										
											2008-05-06 15:48:28 -04:00
										 |  |  | T{ pre/post-content f "x" t } "x<y/>" xml-error-test | 
					
						
							|  |  |  | T{ versionless-prolog f 1 8 } "<?xml?><x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-29 22:41:08 -05:00
										 |  |  | T{ unclosed-quote f 1 12 } "<x value='/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-15 17:35:55 -05:00
										 |  |  | T{ bad-name f 1 3 "-" } "<-/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-26 17:11:30 -05:00
										 |  |  | T{ quoteless-attr f 1 12 } "<x value=<->/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-19 23:25:15 -05:00
										 |  |  | T{ quoteless-attr f 1 10 } "<x value=3/>" xml-error-test | 
					
						
							|  |  |  | T{ attr-w/< f 1 11 } "<x value='<'/>" xml-error-test | 
					
						
							|  |  |  | T{ text-w/]]> f 1 6 } "<x>]]></x>" xml-error-test | 
					
						
							|  |  |  | T{ duplicate-attr f 1 21 T{ name { space "" } { main "this" } } V{ "a" "b" } } "<x this='a' this='b'/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-20 16:37:21 -05:00
										 |  |  | T{ bad-cdata f 1 3 } "<![CDATA[]]><x/>" xml-error-test | 
					
						
							|  |  |  | T{ bad-cdata f 1 7 } "<x/><![CDATA[]]>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-26 17:11:30 -05:00
										 |  |  | T{ pre/post-content f "&" t } " <x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-21 19:16:51 -05:00
										 |  |  | T{ bad-doctype f 1 17 "a" } "<!DOCTYPE foo [ a ]><x/>" xml-error-test | 
					
						
							|  |  |  | T{ bad-doctype f 1 22 T{ opener { name T{ name f "" "foo" "" } } { attrs T{ attrs } } } } "<!DOCTYPE foo [ <foo> ]><x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-29 22:41:08 -05:00
										 |  |  | T{ disallowed-char f 1 4 1 } "<x>\u000001</x>" xml-error-test | 
					
						
							|  |  |  | T{ missing-close f 1 8 } "<!-- foo" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-01-26 17:11:30 -05:00
										 |  |  | T{ misplaced-directive f 1 9 "ENTITY" } "<!ENTITY foo 'bar'><x/>" xml-error-test | 
					
						
							| 
									
										
										
										
											2009-03-18 19:32:34 -04:00
										 |  |  | [ "<?xml version='1.0' encoding='foobar'?>" >byte-array bytes>xml ] [ T{ bad-encoding f 1 39 "foobar" } = ] must-fail-with |