Example #1
0
def test_cast_string_5():
    scriptax = '''
    test = false;
    return str(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "False"
Example #2
0
def test_list_3():
    scriptax = '''
    test = [];
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == []
Example #3
0
def test_return_2():
    scriptax = '''
    test = "worked";
    return self.test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "worked"
Example #4
0
def test_int():
    scriptax = '''
    test = 5;
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == 5
Example #5
0
def test_import():
    scriptax = '''
    from scriptax import testing;
    return true;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == True
Example #6
0
def test_dict_access_3():
    scriptax = '''
    test = {"5": "worked"};
    return test.5;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "worked"
Example #7
0
def test_negative_int():
    scriptax = '''
    test = -509;
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == -509
Example #8
0
def test_cast_int():
    scriptax = '''
    test = "5";
    return int(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == 5
Example #9
0
def test_cast_dec_3():
    scriptax = '''
    test = "5.8";
    return dec(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == 5.8
Example #10
0
def test_cast_dict_7():
    scriptax = '''
    test = true;
    return dict(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == {"default": True}
Example #11
0
def test_cast_dict_8():
    scriptax = '''
    test = null;
    return dict(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == {"default": None}
Example #12
0
def test_cast_dict_4():
    scriptax = '''
    test = '{"day": "night", "nottrue": false}';
    return dict(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == {"day": "night", "nottrue": False}
Example #13
0
def test_cast_list_2():
    scriptax = '''
    test = "";
    return list(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == [""]
Example #14
0
def test_cast_string_6():
    scriptax = '''
    test = null;
    return str(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "None"
Example #15
0
def test_hex():
    scriptax = '''
    test = 0xabcdEF1234567890;
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "0xABCDEF1234567890"
Example #16
0
def test_cast_bool_2():
    scriptax = '''
    test = 0;
    return bool(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == False
Example #17
0
def test_dict():
    scriptax = '''
    test = {"test": "worked"};
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == {"test": "worked"}
Example #18
0
def test_cast_bool_5():
    scriptax = '''
    test = "true";
    return bool(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == True
Example #19
0
def test_complex_object():
    scriptax = '''
    test = {"test": "worked", "test2": [{"yes": "no"}, {"day": "night"}, {"weekend": ["sunday", {"name": "saturday", "best_day": true}]}]};
    return test.test2.2.weekend.1.best_day;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == True
Example #20
0
def test_injection_3():
    scriptax = '''
    inject = "worked";
    return "hi the  test   <|   inject         >     !";
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "hi the  test   worked     !"
Example #21
0
def test_big_int():
    scriptax = '''
    test = 5099327593287521432626;
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == 5099327593287521432626
Example #22
0
def test_injection():
    scriptax = '''
    inject = "worked";
    return "<|inject>";
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "worked"
Example #23
0
def test_import_3():
    scriptax = '''
    from scriptax import testing as bananas;
    return bananas.get_test_static();
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "worked"
Example #24
0
def test_injection_5():
    scriptax = '''
    inject = true;
    return "hi the  test   <|   inject         >     !";
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "hi the  test   True     !"
Example #25
0
def test_import_4():
    scriptax = '''
    import testing;
    return testing.get_test_static();
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "worked"
Example #26
0
def test_injection_6():
    scriptax = '''
    inject = 0xabcdef1234567890;
    return "hi the  test   <|   inject         >     !";
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "hi the  test   0xABCDEF1234567890     !"
Example #27
0
def test_list_access_3():
    scriptax = '''
    test = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    return test.5;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == 5
Example #28
0
def test_injection_7():
    scriptax = '''
    inject = null;
    return "hi the  test   <|   inject         >     !";
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "hi the  test   None     !"
Example #29
0
def test_none():
    scriptax = '''
    test = null;
    return test;
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == None
Example #30
0
def test_cast_string_4():
    scriptax = '''
    test = true;
    return str(test);
    '''
    block_status, visitor = execute(scriptax)
    assert block_status.result == "True"