This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: Additional mimetype parsing tests for DocFlavor
- From: Wolfgang Baer <WBaer at gmx dot de>
- To: mauve-patches at sources dot redhat dot com
- Date: Thu, 23 Feb 2006 14:00:49 +0100
- Subject: FYI: Additional mimetype parsing tests for DocFlavor
Hi,
I added some more tests to the mimetype parsing test.
2006-02-23 Wolfgang Baer <WBaer@gmx.de>
* gnu/testlet/javax/print/DocFlavor/parseMimeType.java
(test): Additional tests for special characters.
Wolfgang
Index: parseMimeType.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/print/DocFlavor/parseMimeType.java,v
retrieving revision 1.2
diff -u -r1.2 parseMimeType.java
--- parseMimeType.java 12 Feb 2006 12:38:59 -0000 1.2
+++ parseMimeType.java 23 Feb 2006 12:53:39 -0000
@@ -124,6 +124,36 @@
}
try
{
+ // wrong character
+ new DocFlavor(" te,xt/plain; charset=us-ascii", "java.io.InputStream");
+ h.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ h.check(true);
+ }
+ try
+ {
+ // only values may be quoted
+ new DocFlavor("text/plain; \"charset\"=us-ascii", "java.io.InputStream");
+ h.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ h.check(true);
+ }
+ try
+ {
+ // ' is an allowed character
+ new DocFlavor(" text/plain; charset=us-asc'ii", "java.io.InputStream");
+ h.check(true);
+ }
+ catch (IllegalArgumentException e)
+ {
+ h.check(false);
+ }
+ try
+ {
// wrongly character in unqouted value
new DocFlavor("text/plain; charset=?us-ascii", "java.io.InputStream");
h.check(false);
@@ -143,6 +173,27 @@
{
h.check(false);
}
+ try
+ {
+ // character in qouted value
+ new DocFlavor("text/plain; param=\"?vöal ue.\"", "java.io.InputStream");
+ h.check(true);
+ }
+ catch (IllegalArgumentException e)
+ {
+ h.check(false);
+ }
+ try
+ {
+ // special characters in mime type
+ DocFlavor syntax = new DocFlavor("application/vnd.cups-command",
+ "java.io.InputStream");
+ h.check(syntax.getMediaSubtype().equals("vnd.cups-command"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ h.check(false);
+ }
}
}