fn from_set_value()

in yaml_test_runner/src/step/do.rs [617:639]


    fn from_set_value(s: &str) -> Tokens {
        // check if the entire string is a token
        if s.starts_with('$') {
            let ident = syn::Ident::from(
                s.trim_start_matches('$')
                    .trim_start_matches('{')
                    .trim_end_matches('}'),
            );
            quote! { #ident }
        } else {
            // only part of the string is a token, so substitute
            let token = syn::Ident::from(
                SET_DELIMITED_REGEX
                    .captures(s)
                    .unwrap()
                    .get(1)
                    .unwrap()
                    .as_str(),
            );
            let replacement = SET_DELIMITED_REGEX.replace_all(s, "{}");
            quote! { Value::String(format!(#replacement, #token.as_str().unwrap())) }
        }
    }