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

[question]running tests fail #89

Open
pangfeng opened this issue Mar 6, 2019 · 2 comments
Open

[question]running tests fail #89

pangfeng opened this issue Mar 6, 2019 · 2 comments

Comments

@pangfeng
Copy link

pangfeng commented Mar 6, 2019

hi,
I run the example in https://openresty.gitbooks.io/programming-openresty/content/testing/running-tests.html, then get this failed result:

t/foo.t .. 
ok 1 - TEST 1: hello, world - status code ok
not ok 2 - TEST 1: hello, world - response_body - response is expected (repeated req 0, req 0)

#   Failed test 'TEST 1: hello, world - response_body - response is expected (repeated req 0, req 0)'
#   at /Library/Perl/5.18/Test/Nginx/Socket.pm line 1387.
#          got: "hello, world!\x{0a}"
#       length: 14
#     expected: "hello, world!\x{0a}--- error_code: 200"
#       length: 33
#     strings begin to differ at char 15 (line 2 column 1)
1..2
# Looks like you failed 1 test of 2.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests 

Test Summary Report
-------------------
t/foo.t (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
Files=1, Tests=2,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.12 cusr  0.04 csys =  0.18 CPU)
Result: FAIL

I don't know what's the reason, please help me fix it.
Thank you!

@nagypeterjob
Copy link

Hey, if its is still relevant:
use no_long_string(); just before you call run_tests();

@agentzh
Copy link
Member

agentzh commented Jun 27, 2019

@pangfeng Make sure there is at least one newline character at the end of your .t file. That error message is a clear indication for the lack of newline character right after the --- error_code: 200 line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants