Repository: nushell/nushell
File: crates/nu_plugin_formats/src/from/ini.rs (Rust)

Code before:
            })),
        },
        Example {
            example: "'[start]
file=C:\\Windows\\System32\\xcopy.exe' | from ini --no-escape",
            description: "Disable escaping to keep backslashes literal",
            result: Some(Value::test_record(record! {
                "start" => Value::test_record(record! {
                    "file" => Value::test_string(r"C:\Windows\System32\xcopy.exe"),
                }),
            })),
        },
        Example {
            example: "'[foo]
bar=\"quoted\"' | from ini --no-quote",
            description: "Disable quote handling to keep quote characters",
            result: Some(Value::test_record(record! {
                "foo" => Value::test_record(record! {
                    "bar" => Value::test_string("\"quoted\""),
                }),
            })),
        },
        Example {
            example: "[\"[foo]\" \"bar=line one\" \"  line two\"] | str join (char newline) | from ini --indented-multiline-value",
            description: "Allow values to continue on indented lines",
            result: None,
        },
        Example {
            example: "[\"[foo]\" \"  key=value\"] | str join (char newline) | from ini --preserve-key-leading-whitespace",
            description: "Preserve leading whitespace in keys",
            result: None,
        },
    ]
}

#[test]
fn test_examples() -> Result<(), nu_protocol::ShellError> {
    use nu_plugin_test_support::PluginTest;

    PluginTest::new("formats", crate::FormatCmdsPlugin.into())?.test_command_examples(&FromIni)
}


Review comment (suggestion):
why are there no results in these last 2. it would be great to have results because examples are tested as tests during cargo test.

Code after:
            })),
        },
        Example {
            example: "'[start]
file=C:\\Windows\\System32\\xcopy.exe' | from ini --no-escape",
            description: "Disable escaping to keep backslashes literal",
            result: Some(Value::test_record(record! {
                "start" => Value::test_record(record! {
                    "file" => Value::test_string(r"C:\Windows\System32\xcopy.exe"),
                }),
            })),
        },
        Example {
            example: "'[foo]
bar=\"quoted\"' | from ini --no-quote",
            description: "Disable quote handling to keep quote characters",
            result: Some(Value::test_record(record! {
                "foo" => Value::test_record(record! {
                    "bar" => Value::test_string("\"quoted\""),
                }),
            })),
        },
        Example {
            example: "'[foo]
bar=line one
  line two' | from ini --indented-multiline-value",
            description: "Allow values to continue on indented lines",
            result: Some(Value::test_record(record! {
                "foo" => Value::test_record(record! {
                    "bar" => Value::test_string("line one\nline two"),
                }),
            })),
        },
        Example {
            example: "'[foo]
  key=value' | from ini --preserve-key-leading-whitespace",
            description: "Preserve leading whitespace in keys",
            result: Some(Value::test_record(record! {
                "foo" => Value::test_record(record! {
                    "  key" => Value::test_string("value"),
                }),
            })),
        },
    ]
}

#[test]
fn test_examples() -> Result<(), nu_protocol::ShellError> {
    use nu_plugin_test_support::PluginTest;

    PluginTest::new("formats", crate::FormatCmdsPlugin.into())?.test_command_examples(&FromIni)