for-GET / katt

KATT (Klarna API Testing Tool) is an HTTP-based API testing tool for Erlang.
https://github.com/for-GET/katt
Apache License 2.0
119 stars 16 forks source link

Triple backtick in blueprint #15

Closed bullno1 closed 9 years ago

bullno1 commented 9 years ago

I'd like to put a request block inside a triple backtick block so that a blueprint file can be rendered as markdown. However, if I have more than two of those blocks, katt will fail to parse the blueprint:

{{badmatch,{fail,{expected,{no_match,<<"`">>},{{line,33},{column,1}}}}},
 [{katt_blueprint_parse,file,1,
                        [{file,"src/katt_blueprint_parse.erl"},{line,55}]},
  {katt,run,4,[{file,"src/katt.erl"},{line,89}]}]}.
andreineculau commented 9 years ago

Would you be so kind and send an example of the KATT files that fail to parse?

On 25 Sep 2015, at 08:53, Bach Le notifications@github.com wrote:

When I put arequest block inside a triple backtick block so that a blueprint file can be rendered as markdown. However, if I have more than two of those blocks, katt will fail to parse the blueprint:

{{badmatch,{fail,{expected,{no_match,<<"`">>},{{line,33},{column,1}}}}}, [{katt_blueprint_parse,file,1, [{file,"src/katt_blueprint_parse.erl"},{line,55}]}, {katt,run,4,[{file,"src/katt.erl"},{line,89}]}]}. — Reply to this email directly or view it on GitHub.

bullno1 commented 9 years ago

Sorry, I forgot. It's pretty simple: https://gist.github.com/bullno1/96964bcccca3023402ec


Edited to have the example inline (ignore the dot prefixing the backticks) /Andrei

# Registration

Short passwords will be rejected:

.```
PUT /users/bullno1
> Content-Type: application/json
> Accept: application/json
{"password": "short"}
< 400
{{_}}
.```

Registration can succeed with a longer password:

.```
PUT /users/bullno1
> Content-Type: application/json
> Accept: application/json
{"password": "this is long enough"}
< 400
{{_}}
.```
andreineculau commented 9 years ago

Thanks, I'll have a look at what is happening, but meanwhile you can try adding an empty line before closing (maybe after beginning as well?!) the code blocks

andreineculau commented 9 years ago

@bullno1 can you take the andrein/15_handle_non_empty_apib_footer branch out for a test and confirm the fix?

It wasn't the number of code blocks btw that was the problem, but the last transaction couldn't have had terminating ticks.

andreineculau commented 9 years ago

ping @bullno1

bullno1 commented 9 years ago

While I was trying to build andrein/15_handle_non_empty_apib_footer using make, I got the following error:

Pulling lhttpc from {git,"git://github.com/waisbrot/lhttpc.git",
                         "824a89316d59353181990f5a461157751ca67907"}
Cloning into 'lhttpc'...
fatal: reference is not a tree: 824a89316d59353181990f5a461157751ca67907
ERROR: sh(git checkout -q 824a89316d59353181990f5a461157751ca67907)

My git version is 2.6.2

andreineculau commented 9 years ago

try "git cherry-pick 44d6a52815f23d901a00ef0a909f998d39617683" and then make

On Thu, Nov 5, 2015 at 1:49 PM, Bach Le notifications@github.com wrote:

While I was trying to build andrein/15_handle_non_empty_apib_footer using make, I got the following error:

Pulling lhttpc from {git,"git://github.com/waisbrot/lhttpc.git", "824a89316d59353181990f5a461157751ca67907"} Cloning into 'lhttpc'... fatal: reference is not a tree: 824a89316d59353181990f5a461157751ca67907 ERROR: sh(git checkout -q 824a89316d59353181990f5a461157751ca67907)

My git version is 2.6.2

— Reply to this email directly or view it on GitHub https://github.com/for-GET/katt/issues/15#issuecomment-154049935.

andreineculau.com http://www.andreineculau.com

bullno1 commented 9 years ago

That seems to fix it. Those files can be parsed now.

andreineculau commented 9 years ago

Thank you for confirming. I will soon merge the fix then

On Thu, Nov 5, 2015 at 7:04 PM, Bach Le notifications@github.com wrote:

That seems to fix it. Those files can be parsed now.

— Reply to this email directly or view it on GitHub https://github.com/for-GET/katt/issues/15#issuecomment-154139826.

andreineculau.com http://www.andreineculau.com