rt/vm/src/test/java/org/apidesign/vm4brwsr/ImportedFieldTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 24 Feb 2015 11:12:53 +0100
changeset 1787 ea12a3bb4b33
parent 1772 e80693152d8b
permissions -rw-r--r--
Using year range 2012-2015 in copyright header
jaroslav@106
     1
/**
jaroslav@106
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1787
     3
 * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@106
     4
 *
jaroslav@106
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@106
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@106
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@106
     8
 *
jaroslav@106
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@106
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@106
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@106
    12
 * GNU General Public License for more details.
jaroslav@106
    13
 *
jaroslav@106
    14
 * You should have received a copy of the GNU General Public License
jaroslav@106
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@106
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@106
    17
 */
jaroslav@22
    18
package org.apidesign.vm4brwsr;
jaroslav@0
    19
jaroslav@1497
    20
import javax.script.ScriptEngine;
jaroslav@789
    21
import org.testng.annotations.AfterClass;
jaroslav@103
    22
import org.testng.annotations.BeforeClass;
jaroslav@0
    23
import org.testng.annotations.Test;
jaroslav@0
    24
jaroslav@1772
    25
/** Tests whether we can access public field from a class in extension.
jaroslav@0
    26
 *
jaroslav@0
    27
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@0
    28
 */
jaroslav@1772
    29
public class ImportedFieldTest {
jaroslav@1497
    30
    @Test public void checkHello() throws Exception {
jaroslav@1493
    31
        
jaroslav@1772
    32
        code.assertExec("Can access field from extension",
jaroslav@1772
    33
            ImplementFactory.class, "meaning__I", 
jaroslav@1772
    34
            42
jaroslav@291
    35
        );
jaroslav@291
    36
    }
jaroslav@1519
    37
jaroslav@708
    38
    private static TestVM code;
jaroslav@103
    39
    
jaroslav@103
    40
    @BeforeClass 
jaroslav@789
    41
    public static void compileTheCode() throws Exception {
jaroslav@103
    42
        StringBuilder sb = new StringBuilder();
jaroslav@1497
    43
        ScriptEngine[] eng = { null };
jaroslav@1772
    44
        code = TestVM.compileClassesAsExtension(sb, eng, null, null,
jaroslav@1772
    45
            "org/apidesign/vm4brwsr/extrnl/ImportedField",
jaroslav@1772
    46
            "org/apidesign/vm4brwsr/extrnl/ImportedField$Factory"
jaroslav@1497
    47
        );
jaroslav@1610
    48
        code = TestVM.compileClassesAsExtension(sb, eng, null, null,
jaroslav@1610
    49
            "org/apidesign/vm4brwsr/ImplementFactory", 
jaroslav@1610
    50
            "org/apidesign/vm4brwsr/ImplementFactory$Impl"
jaroslav@1496
    51
        );
jaroslav@2
    52
    }
jaroslav@789
    53
    @AfterClass
jaroslav@789
    54
    public static void releaseTheCode() {
jaroslav@789
    55
        code = null;
jaroslav@789
    56
    }
jaroslav@0
    57
}