-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added error handling with html display (#117)
* Implemented error handling and initial html display * Improved html display and tests for error handling
- Loading branch information
Showing
7 changed files
with
88 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -518,6 +518,10 @@ pre.sourceCode.julia { | |
border-radius: 4px; | ||
} | ||
|
||
pre.julia-error { | ||
color : red | ||
} | ||
|
||
code, | ||
kbd, | ||
pre, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -515,6 +515,10 @@ pre.sourceCode.julia { | |
border-radius: 4px; | ||
} | ||
|
||
pre.julia-error { | ||
color : red | ||
} | ||
|
||
code, | ||
kbd, | ||
pre, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Weave | ||
using Base.Test | ||
|
||
s1= """ | ||
```julia | ||
using NonExisting | ||
``` | ||
```julia | ||
x = | ||
``` | ||
```julia;term=true | ||
plot(x) | ||
y = 10 | ||
print(y | ||
``` | ||
""" | ||
|
||
p1 = Weave.parse_doc(s1, "markdown") | ||
doc = Weave.WeaveDoc("dummy1.jmd", p1, Dict()) | ||
doc1 = Weave.run(doc, doctype = "pandoc") | ||
|
||
@test doc1.chunks[1].output == "Error: ArgumentError: Module NonExisting not found in current path.\nRun `Pkg.add(\"NonExisting\")` to install the NonExisting package.\n" | ||
@test doc1.chunks[2].output == "Error: syntax: incomplete: premature end of input\n" | ||
@test doc1.chunks[3].output == "\njulia> plot(x)\nError: UndefVarError: plot not defined\n\njulia> y = 10\n10\n\njulia> print(y\nError: syntax: incomplete: premature end of input\n" | ||
|
||
try | ||
doc2 = Weave.run(doc, doctype = "pandoc", throw_errors = true) | ||
catch E | ||
@test typeof(E) == ArgumentError | ||
@test E.msg == "Module NonExisting not found in current path.\nRun `Pkg.add(\"NonExisting\")` to install the NonExisting package." | ||
end | ||
|
||
doc = Weave.WeaveDoc("dummy1.jmd", p1, Dict()) | ||
doc3 = Weave.run(doc, doctype = "md2html") | ||
@test doc3.chunks[1].rich_output == "<pre class=\"julia-error\">\nERROR: ArgumentError: Module NonExisting not found in current path.\nRun `Pkg.add("NonExisting")` to install the NonExisting package.\n</pre>\n" | ||
@test doc3.chunks[2].rich_output == "<pre class=\"julia-error\">\nERROR: syntax: incomplete: premature end of input\n</pre>\n" | ||
@test doc3.chunks[3].output == "\njulia> plot(x)\nError: UndefVarError: plot not defined\n\njulia> y = 10\n10\n\njulia> print(y\nError: syntax: incomplete: premature end of input\n" | ||
@test doc3.chunks[3].rich_output == "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters