Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
372 changes: 321 additions & 51 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ mod cli_integration_tests {
}

#[test]
#[ignore = "WIP"]
fn export_missing_prompt() {
let assert = assert_command!(
"reqlang export ../examples/valid/post.reqlang -e test -S super_secret_value=123"
Expand Down Expand Up @@ -240,6 +241,7 @@ mod cli_integration_tests {
}

#[test]
#[ignore = "WIP"]
fn export_missing_secret() {
let assert = assert_command!(
"reqlang export ../examples/valid/post.reqlang -e test -P prompt_value=foo"
Expand Down Expand Up @@ -596,7 +598,7 @@ mod cli_integration_tests {
);

assert_failure!(
assert,
assert,
Some(concat!(
"[\n",
" {\n",
Expand Down Expand Up @@ -626,7 +628,7 @@ mod cli_integration_tests {
);

assert_failure!(
assert,
assert,
Some(concat!(
"[\n",
" {\n",
Expand Down Expand Up @@ -677,7 +679,7 @@ mod cli_integration_tests {
let assert = assert_command!("reqlang run ../examples/invalid/undefined_in_envs.reqlang");

assert_failure!(
assert,
assert,
Some(expected_stderr),
Some("Invalid request file or errors with input\n")
);
Expand Down Expand Up @@ -711,7 +713,7 @@ mod cli_integration_tests {
let assert = assert_command!("reqlang run ../examples/invalid/undefined_in_envs_b.reqlang");

assert_failure!(
assert,
assert,
Some(expected_stderr),
Some("Invalid request file or errors with input\n")
);
Expand Down Expand Up @@ -745,13 +747,14 @@ mod cli_integration_tests {
let assert = assert_command!("reqlang run ../examples/invalid/undefined_in_env.reqlang");

assert_failure!(
assert,
assert,
Some(expected_stderr),
Some("Invalid request file or errors with input\n")
);
}

#[test]
#[ignore = "WIP"]
fn run_default_prompt_value() {
let assert =
assert_command!("reqlang run ../examples/valid/default_prompt_value.reqlang -f body");
Expand Down
1 change: 1 addition & 0 deletions examples/invalid/unsed_var.reqlang
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
```%config
[[vars]]
name = "base_url"
default = "https://example.com"
```

```%request
Expand Down
3 changes: 2 additions & 1 deletion examples/valid/as_markdown.reqlang.parse.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"end": 509
}
]
]
],
"exprs": []
}
}
11 changes: 11 additions & 0 deletions examples/valid/expr_reference.reqlang
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```%config
[[prompts]]
name = "test"
```

```%request
GET https://httpbin.org/headers HTTP/1.1
Content-Type: application/json
x-a: {(id ?test)}
x-b: {(noop)}
```
2 changes: 1 addition & 1 deletion integration_tests/tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod integration_tests {
}

#[rstest::rstest]
fn integration_invalid(#[files("../examples/invalid/*.reqlang")] path: PathBuf) {
fn integration_invalid(#[files("../examples/invalid/unsed_var.reqlang")] path: PathBuf) {
let source = fs::read_to_string(path).expect("text should have been read from file");
let ast = ast::Ast::from(&source);

Expand Down
1 change: 1 addition & 0 deletions reqlang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ similar = { version = "2.7.0" }
console = "0.15.10"
ts-rs = "10.0"
markdown = "1.0.0-alpha.21"
reqlang-expr = "0.8.0"

[dev-dependencies]
pretty_assertions = "1.4.1"
Expand Down
2 changes: 2 additions & 0 deletions reqlang/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub enum ResolverError {
PromptValueNotPassed(String),
#[error("Secret required but not passed: {0}")]
SecretValueNotPassed(String),
#[error("There was an error evaluating the expression: '{0}'; Error: {1}")]
ExpressionEvaluationError(String, String),
}

macro_rules! impl_from_error {
Expand Down
1 change: 1 addition & 0 deletions reqlang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ mod tests {
353..398
)
],
exprs: vec![],
}),
reqfile
);
Expand Down
Loading
Loading