let file = get_file("test.json");
file.drop();

let file2 = get_file("test.json");
file2.open(false, true, false);

file2.write_str("This is content".ref());

let bytes = arr<Int>();
bytes.push(46); // dot
file2.write_bytes(bytes.demut());

file2.drop();

let file3 = get_file("test.json");
file3.open(true, false, false);

let contents = file3.read_str();

if contents != "This is content." {
    panic("Invalid contents");
}

file3.drop();

let file4 = get_file("test.json");
file4.open(true, false, false);

let contents_b = file4.read_bytes(5);

if contents_b.len() != 5 {
    panic("Invalid contents_b");
}

if !file4.delete() {
    panic("Unable to remove file");
}