Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type input variables #120

Closed
fabricereix opened this issue Jan 11, 2021 · 1 comment
Closed

Type input variables #120

fabricereix opened this issue Jan 11, 2021 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@fabricereix
Copy link
Collaborator

Values used in Hurl in Captures/Assert are typed (integer, boolean, string,...)
On the opposite, the input variables (from the option --variable) are all strings.

sample.hurl 
 1  GET http://localhost:8000/hello
 2  HTTP/* 200
 3  [Asserts]
 4  variable "count" equals "1"
 5  variable "count" equals 1

$ hurl --variable count=1 sample.hurl 
error: Assert Failure
  --> /tmp/sample.hurl:5:0
   |
 5 | variable "count" equals 1
   |   actual:   string <1>
   |   expected: int <1>
   |

It will be interesting to type the input variable implicitly.
The string <1> should be treated as integer, therefore the first assert should fail rather than the second.

Similarly, the value should be treated as bool.
To force a string value, the value can be quoted.
This is consistent with the predicate value.

For example, the id <123> is passed as string as follow:

hurl --variable id='"123"' sample.hurl 
@fabricereix fabricereix added the enhancement New feature or request label Jan 11, 2021
@lepapareil lepapareil added this to the 1.3.0 milestone Feb 23, 2021
@fabricereix fabricereix added 1.2.0 and removed 1.3.0 labels Feb 25, 2021
@fabricereix
Copy link
Collaborator Author

implemented in #176

@fabricereix fabricereix modified the milestones: 1.3.0, 1.2.0 Feb 25, 2021
@lepapareil lepapareil removed the 1.2.0 label Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants