dew/src/test/java/org/apidesign/bck2brwsr/dew/CompileTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 07 Feb 2013 12:58:12 +0100
branchemul
changeset 694 0d277415ed02
parent 469 c6e6782950b8
child 1295 5b3ae17babdf
permissions -rw-r--r--
Rebasing the Inflater support on jzlib which, unlike GNU ClassPath, has correct implementation of Huffman code. Making the implementation more easily testable by turning Inflater and ZipInputStream into pure delegates. Current implementation is going to need proper long support.
jaroslav@468
     1
/**
jaroslav@468
     2
 * Back 2 Browser Bytecode Translator
jaroslav@468
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@468
     4
 *
jaroslav@468
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@468
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@468
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@468
     8
 *
jaroslav@468
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@468
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@468
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@468
    12
 * GNU General Public License for more details.
jaroslav@468
    13
 *
jaroslav@468
    14
 * You should have received a copy of the GNU General Public License
jaroslav@468
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@468
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@468
    17
 */
jaroslav@462
    18
package org.apidesign.bck2brwsr.dew;
jaroslav@462
    19
jaroslav@462
    20
import java.io.IOException;
jaroslav@462
    21
import static org.testng.Assert.*;
jaroslav@462
    22
import org.testng.annotations.Test;
jaroslav@462
    23
jaroslav@462
    24
/**
jaroslav@462
    25
 *
jaroslav@462
    26
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@462
    27
 */
jaroslav@462
    28
public class CompileTest  {
jaroslav@462
    29
    @Test public void testCompile() throws IOException {
jaroslav@462
    30
        String html = "<html><body>"
jaroslav@462
    31
                + " <button id='btn'>Hello!</button>"
jaroslav@462
    32
                + "</body></html>";
jaroslav@462
    33
        String java = "package x.y.z;"
jaroslav@463
    34
                + "import org.apidesign.bck2brwsr.htmlpage.api.*;"
jaroslav@469
    35
                + "import static org.apidesign.bck2brwsr.htmlpage.api.OnEvent.*;"
jaroslav@463
    36
            + "@Page(xhtml=\"index.html\", className=\"Index\")"
jaroslav@463
    37
            + "class X { "
jaroslav@469
    38
            + "   @On(event=CLICK, id=\"btn\") static void clcs() {}"
jaroslav@463
    39
            + "}";
jaroslav@464
    40
        Compile result = Compile.create(html, java);
jaroslav@462
    41
jaroslav@462
    42
        assertNotNull(result.get("x/y/z/X.class"), "Class X is compiled: " + result);
jaroslav@463
    43
        assertNotNull(result.get("x/y/z/Index.class"), "Class Index is compiled: " + result);
jaroslav@462
    44
    }
jaroslav@462
    45
}