Skip to content

Commit af6d2bf

Browse files
committed
Add option continue-on-error in config_file
1 parent 6d2e5e1 commit af6d2bf

7 files changed

Lines changed: 47 additions & 0 deletions

File tree

docs/spec/options/hurl/continue_on_error.option

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ long: continue-on-error
33
help: Continue executing requests even if an error occurs
44
help_heading: Run options
55
cli_only: true
6+
config_file: true
67
env_var: HURL_CONTINUE_ON_ERROR
78
---
89
Continue executing requests to the end of the Hurl file even when an assert error occurs. By default, Hurl exits after an assert error in the HTTP response.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--continue-on-error
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: Assert status code
2+
--> tests_failed/continue_on_error/continue_on_error.hurl:2:6
3+
|
4+
| GET http://localhost:8000/continue-on-error
5+
2 | HTTP 400
6+
| ^^^ actual value is <200>
7+
|
8+
9+
error: Assert status code
10+
--> tests_failed/continue_on_error/continue_on_error.hurl:8:6
11+
|
12+
| GET http://localhost:8000/continue-on-error
13+
8 | HTTP 400
14+
| ^^^ actual value is <200>
15+
|
16+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Set-StrictMode -Version latest
2+
$ErrorActionPreference = 'Stop'
3+
4+
$env:XDG_CONFIG_HOME = "$PSScriptRoot/config"
5+
6+
hurl tests_failed/continue_on_error/continue_on_error.hurl
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -Eeuo pipefail
3+
4+
XDG_CONFIG_HOME=$(dirname "$0")/config
5+
export XDG_CONFIG_HOME
6+
7+
hurl tests_failed/continue_on_error/continue_on_error.hurl

packages/hurl/src/cli/options/config_file/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ fn parse_option(reader: &mut Reader, options: &mut CliOptions) -> Result<(), Con
250250
options.fail_with_body = true;
251251
Ok(())
252252
}
253+
"continue-on-error" => {
254+
expect_no_value(reader)?;
255+
options.continue_on_error = true;
256+
Ok(())
257+
}
253258
"no-assert" => {
254259
expect_no_value(reader)?;
255260
options.no_assert = true;
@@ -524,6 +529,16 @@ mod tests {
524529
assert_eq!(reader.cursor().pos, Pos::new(2, 1));
525530
}
526531

532+
#[test]
533+
fn test_parse_option_continue_on_error() {
534+
let mut reader = Reader::new("--continue-on-error\n");
535+
let mut options = CliOptions::default();
536+
assert!(!options.continue_on_error);
537+
assert!(parse_option(&mut reader, &mut options).is_ok());
538+
assert!(options.continue_on_error);
539+
assert_eq!(reader.cursor().pos, Pos::new(2, 1));
540+
}
541+
527542
#[test]
528543
fn test_parse_option_http11() {
529544
let mut reader = Reader::new("--http1.1\n");

0 commit comments

Comments
 (0)