Skip to content

Commit 80a8b5d

Browse files
VolkerVolker
authored andcommitted
Test for static variables
1 parent dd29280 commit 80a8b5d

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2018 Volker Berlin (i-net software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package de.inetsoftware.jwebassembly.runtime;
17+
18+
import java.util.ArrayList;
19+
import java.util.Collection;
20+
21+
import org.junit.ClassRule;
22+
import org.junit.runners.Parameterized.Parameters;
23+
24+
import de.inetsoftware.jwebassembly.ScriptEngine;
25+
import de.inetsoftware.jwebassembly.WasmRule;
26+
import de.inetsoftware.jwebassembly.api.annotation.Export;
27+
28+
public class StaticValues extends AbstractBaseTest {
29+
30+
@ClassRule
31+
public static WasmRule rule = new WasmRule( TestClass.class );
32+
33+
public StaticValues( ScriptEngine script, String method, Object[] params ) {
34+
super( rule, script, method, params );
35+
}
36+
37+
@Parameters( name = "{0}-{1}" )
38+
public static Collection<Object[]> data() {
39+
ArrayList<Object[]> list = new ArrayList<>();
40+
for( ScriptEngine[] val : ScriptEngine.testParams() ) {
41+
ScriptEngine script = val[0];
42+
addParam( list, script, "abc" );
43+
}
44+
return list;
45+
}
46+
47+
static class TestClass {
48+
49+
static int condition;
50+
51+
@Export
52+
static int abc() {
53+
condition = 42;
54+
return condition;
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)