-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix broken html report when benchmark names contain '\'' #203
Conversation
While this works, it might actually be a bit overkill. Why not just change the single quotes to double quotes, like so? diff --git a/templates/default.tpl b/templates/default.tpl
index 5366899..95bdee1 100644
--- a/templates/default.tpl
+++ b/templates/default.tpl
@@ -287,7 +287,7 @@ $(function () {
reports.map(mangulate);
var benches = [{{#report}}"{{name}}",{{/report}}];
- var ylabels = [{{#report}}[-{{number}},'<a href="#b{{number}}">{{name}}</a>'],{{/report}}];
+ var ylabels = [{{#report}}[-{{number}},"<a href=\"#b{{number}}\">{{name}}</a>"],{{/report}}]
var means = $.scaleTimes([{{#report}}{{anMean.estPoint}},{{/report}}]);
var stddevs = [{{#report}}{{anStdDev.estPoint}},{{/report}}];
stddevs = $.scaleBy(means[1], stddevs); This bypasses the need to escape single quotes within |
Good point. But wouldn't that create the same problem when using benchmark names containing double quotes? Anyway I'll try and also will try to write some tests. I'll work on this next weekend. I've you could suggest off the top of your head how this could be tested (at the right level of abstraction - how to check the generated stuff passes as valid javascript no matter what appears in benchmark's name?) It would be great. Otherwise I'll take this as an exercise for myself and try to figure something out :-) |
That's a good question, but I'm not sure of the answer myself. We already have one test ( |
Hello @RyanGlScott Instead I just locally modified the first10kChars = take 10000 [minBound::Char ..] and then manually verified (by opening the report in the browser) which of these chars break the charts in the report, comparing the previous and fixed implementation. Results:
Even though it fixes just one char (and breaks no others) I'd suggest we merge this, because I feel it's relatively more likely that people include apostrophe in the benchmark name, |
Thanks for the thorough testing! I agree that it's probably best to just merge this as-is. |
Proposed fix for #202