Skip to content

Panic duric transform - null for loop #37

@deevyansh

Description

@deevyansh

Description

The null in the for expression gives the panic during transform.

Steps to Reproduce

  1. The following code to be included in the main.rs
use jslt::Jslt;
use serde_json::json;
use std::fs;
fn main() -> Result<(), Box <dyn std::error::Error> > {
  let jslt: Jslt = r#"
[for(null) . ]
  "#.parse()?;
  let input = json!({
    "data": [
       [1, 2, 3, 4, 5],
       [6, 7, 8, 9, 10]
    ]
  });
  let output = jslt.transform_value(&input)?;
  println!("{}",output);
  assert_eq!("null",output.to_string());
  Ok(())
}

Actual Output

thread 'main' panicked at jslt_dev/jslt/src/transform/value/array.rs:81:18:
Should be array

Expected Output

null

Environment

Nightly Rust Toolchain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions