Skip to content

Variables cannot be defined inbetween printable lines #9

Description

@kaisalmon

Describe the issue
The following unit test fails

#[test]
fn global_variables_can_be_defined_in_between_prints() {
    let content = "
    VAR x = 10
    {x} is ten
    VAR z = 12
    Now {x} and {z} are both set
";

    let mut story = read_story_from_string(content).unwrap();
    let mut line_buffer = Vec::new();

    story.resume(&mut line_buffer).unwrap();

    assert_eq!(
        &line_buffer[0].text,
        "10 is ten\n"
    );
    assert_eq!(
        &line_buffer[1].text,
        "Now 10 and 12 are both set\n"
        
    );
}

However, when running Inky, this code:

   VAR x = 10
    {x} is ten
    VAR z = 12
    Now {x} and {z} are both set

prints out

10 is ten

Now 10 and 12 are both set

without any issue.

To Reproduce
Copy paste the unit test into tests\setting_variables.rs

Expected behavior
The unit test above should pass

Screenshots
image

System (please complete the following information):

  • OS: Windows
  • OS version]: 11
  • Rust version: 1.71.1
  • Enabled features serde_support disabled

Additional context
The error returned is

thread 'global_variables_can_be_defined_in_between_prints' panicked at 'called `Result::unwrap()` on an `Err` value: ValidationError(ValidationError { invalid_address_errors: [InvalidAddressError { kind: UnknownAddress { name: "z" }, meta_data: MetaData { line_index: 4 } }], name_space_errors: [], variable_errors: [] })', tests\setting_variables.rs:141:53

I am to attempt and fix this
I am aware this repo seem very very dead. I ran into this issue when experimenting with adding additional features into the repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions