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

Feature request: executing lines in jldoctest without a result line (like Python) #766

Closed
mm3509 opened this issue Jul 25, 2018 · 4 comments

Comments

@mm3509
Copy link

mm3509 commented Jul 25, 2018

Sometimes I want to test part of an object instead of the full structure. So I bind it to a variable first and then test part of it. If I write a test ending with a semicolon and an empty line next, the test passes:

```jldoctest
julia> c = (10, 20);

julia> c[1] == 10
true
```

But if I omit that empty line, as I would in a Python doc-test, then c is not defined:

```jldoctest
julia> c = (10, 20);
julia> c[1] == 10
true
```
ERROR: UndefVarError: c = (10, 20);not defined

This is similar to #452, but separate in my view.

@fredrikekre
Copy link
Member

But that is not how it looks in the REPL?

@mm3509
Copy link
Author

mm3509 commented Jul 26, 2018

No, indeed it is not, and the Python REPL simply omits the empty line. Is the objective to show the code inside ```jldoctest as if it were typed in a REPL?

@KristofferC
Copy link
Member

KristofferC commented Jul 26, 2018

Yes, you can copy paste the code from a jldoctest straight into the REPL, including prompts and it will work (unless you are on windows, unfortunately).

@fredrikekre
Copy link
Member

I don' think we will change this.

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