You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: script_runtime_error.rs
    path of file: ./repos/tremor-runtime/tests
    
    the code of the file until where you have to start completion: // Copyright 2020-2021, The Tremor Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use pretty_assertions::assert_eq;
use serial_test::serial;
use std::io::prelude::*;
use tremor_common::file;
use tremor_runtime::errors::*;
use
    
            fn $file() -> Result<()> {

                tremor_runtime::functions::load()?;
                let script_dir = concat!("tests/script_runtime_errors/", stringify!($file), "/").to_string();
                let script_file = concat!("tests/script_runtime_errors/", stringify!($file), "/script.tremor");
                let in_file = concat!("tests/script_runtime_errors/", stringify!($file), "/in.xz");
                let err_file = concat!("tests/script_runtime_errors/", stringify!($file), "/error.txt");

                println!("Loading script: {}", script_file);
                let mut file = file::open(script_file)?;
                let mut contents = String::new();
                file.read_to_string(&mut contents)?;

                Manager::clear_path()?;
                Manager::add_path(&script_dir)?;
                Manager::add_path(&"tremor-script/lib")?;
                let script = Script::parse(&contents, &*FN_REGISTRY.read()?)?;

                println!("Loading input: {}", in_file);
                let mut in_json = load_event_file(in_file)?;

                println!("Loading error: {}", err_file);
                let mut file = file::open(err_file)?;
                let mut err = String::new();
                file.read_to_string(&mut err)?;
                let _err = err.trim();

                let mut state = Value::null();
                if let Some(mut json) =  in_json.pop() {
                    let context = EventContext::new(0, None);
                    let mut meta = Value::object();
                    let s = script.run(&context, AggrType::Tick, &mut json, &mut state, &mut meta);
                    if let Err(e) = s {
                        let got = Dumb::error_to_string(&e)?;
                        print!("{}", got);
                        assert_eq!(err.trim(), got.trim());
                    } else {
                        println!("Expected error, but got succeess");
                        assert!(false);
                    }
                }
                assert!(in_json.is_empty());
                Ok(())
            }