aboutsummaryrefslogtreecommitdiffstats
path: root/tests/reproducers/simple/JSToJSet/resources/JSToJava_Set.js
blob: cf92110204197e5bd9ff7af44932a4f581ebadca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function doSetTests( ){

    var urlArgs = document.URL.split("?");
    var testParams = urlArgs[1].split(";");
    var applet = document.getElementById('jstojSetApplet');
    var field = testParams[0];
    var value = testParams[1];

    if( value === "JavaScript"){
        if( field === "_char"){
            value = 97;
        }

        if( field === "_Character"){
            value = new (applet.Packages).java.lang.Character(65);
        }

        if( field === "_specialString"){
            value = "𠁎〒£$ǣ€𝍖";
        } 
    }else if(value.indexOf('[') != -1){

        var elem = value.substring(1);
        value = new Array();
        eval('value[0] = elem');

    }

    eval('applet.' + field + '= value');

    //modifiing _intArray[0]    into  _intArray
    //          _DoubleArray[0] into  _DoubleArray   
    var nameEnd = field.indexOf('[');
    if( nameEnd != -1){
      field = field.substring(0,nameEnd);
    }
    
    applet.printNewValueAndFinish(field);
}