[hg] main-silver: #226122: tests added for new API

  • From: Svata Dedic < >
  • To:
  • Subject: [hg] main-silver: #226122: tests added for new API
  • Date: Sun, 03 Mar 2013 02:39:49 -0800

changeset ce26f4635620 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/ce26f4635620
description:
        #226122: tests added for new API

diffstat:

 
editor.mimelookup/test/unit/src/org/netbeans/api/editor/mimelookup/MimePathTest.java
 |  30 ++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diffs (40 lines):

diff --git 
a/editor.mimelookup/test/unit/src/org/netbeans/api/editor/mimelookup/MimePathTest.java
 
b/editor.mimelookup/test/unit/src/org/netbeans/api/editor/mimelookup/MimePathTest.java
--- 
a/editor.mimelookup/test/unit/src/org/netbeans/api/editor/mimelookup/MimePathTest.java
+++ 
b/editor.mimelookup/test/unit/src/org/netbeans/api/editor/mimelookup/MimePathTest.java
@@ -224,6 +224,36 @@
         assertNull("text/c++ is not a compound mime type", generic);
     }
     
+    public void testInheritedType() throws Exception {
+        // simple path must recognize the +xml
+        MimePath path = MimePath.parse("text/x-ant+xml");
+        String parentMime = path.getInheritedType();
+        assertEquals("text/xml", parentMime);
+        
+        // the same for nested path
+        path = MimePath.parse("text/x-ant+xml/text/x-java/text/x-ant+xml");
+        parentMime = path.getInheritedType();
+        assertEquals("text/xml", parentMime);
+        
+        // only the last component is considered, so no text/x-java as 
inherited type
+        path = MimePath.parse("text/x-ant+xml/text/x-java/text/x-javadoc");
+        parentMime = path.getInheritedType();
+        assertEquals("", parentMime);
+    }
+    
+    public void testIncludedPaths() throws Exception {
+        String path = "text/x-java/text/x-ant+xml/text/html/text/xml";
+        MimePath mp = MimePath.parse(path);
+        
+        List<MimePath> mpaths = mp.getIncludedPaths();
+        
+        assertEquals(mp, mpaths.get(0));
+        assertEquals(MimePath.parse("text/x-ant+xml/text/html/text/xml"), 
mpaths.get(1));
+        assertEquals(MimePath.parse("text/xml/text/html/text/xml"), 
mpaths.get(2));
+        assertEquals(MimePath.parse("text/html/text/xml"), mpaths.get(3));
+        assertEquals(MimePath.parse("text/xml"), mpaths.get(4));
+    }
+    
     private void checkPaths(List expectedPaths, List paths) {
         assertEquals("Wrong number of paths", expectedPaths.size(), 
paths.size());
         

[hg] main-silver: #226122: tests added for new API

Svata Dedic 03/03/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close