codeframe 0.1.5

Capture pretty code-frames.
Documentation
use codeframe::{capture_codeframe, Color};

use k9::*;

macro_rules! get_codeframe {
    () => {{
        let codeframe = capture_codeframe!(Color::Blue);
        codeframe
    }};
}

macro_rules! get_codeframe_with_default_color {
    () => {{
        let codeframe = capture_codeframe!();
        codeframe
    }};
}

#[test]
fn with_color() {
    super::setup_test_env();
    let codeframe = get_codeframe!();
    if let Some(_codeframe) = &codeframe {}
    assert_matches_inline_snapshot!(
        format!("\n{}", &codeframe.expect("must be present")),
        "
20 | fn with_color() {
21 |     super::setup_test_env();
22 |     let codeframe = get_codeframe!();
23 |     if let Some(_codeframe) = &codeframe {}
24 |     assert_matches_inline_snapshot!(
"
    );
}

#[test]
fn without_color() {
    super::setup_test_env();
    let codeframe = get_codeframe_with_default_color!();
    if let Some(_codeframe) = &codeframe {}
    assert_matches_inline_snapshot!(
        format!("\n{}", &codeframe.expect("must be present")),
        "
37 | fn without_color() {
38 |     super::setup_test_env();
39 |     let codeframe = get_codeframe_with_default_color!();
40 |     if let Some(_codeframe) = &codeframe {}
41 |     assert_matches_inline_snapshot!(
"
    );
}