You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came to have the opinion that the important code written for the workshoppers is obfuscated by workshopper-exercise and adventure in different ways but both hang on the same issue: They try to take the work of "comparing output of executed code for you". Now I think that it would be cleanest to get a tool that would do nothing else but compare two streams and end with an error or regular message.
And the API for the compare should tool like this:
varoptions={actual: String// The title to be shown for the actual sectionexpected: String// The title to be shown for the expected section}functioncallback(err,compared){if(err){// true if }compared// Markdown table with the differences highlighted as ``**`` bold ``**`` }varstream=compareStream(options,streamA,streamB,callback);
Thinking of it: an even more abstract API might be better, since markdown rendering might be problematic if the content contains other markdown syntax.
varstream=compareStreamByLine(streamA,streamB)varerror=falsestream.on('data',function(line){line// Array with the parts that are same/different:// ["ab", ["cd", "ef"], "12"] for the inputs "abcd12" and "abef12"console.log(format(line))// Here it is possible to format the line and immediately show the output// We can detect problems with this little trickif(line.length>0||Array.isArray(line[0]){error=true}})stream.on('error',function(errorInfo){// If an error occured while reading the streamerrorInfo.stream;// 'a' or 'b' if an error occurred null if the error occurred somewhere elseerrorInfo.err// error that occurederror=true})stream.on('end',function(){if(error){console.log('error occurred')}})
I came to have the opinion that the important code written for the workshoppers is obfuscated by workshopper-exercise and adventure in different ways but both hang on the same issue: They try to take the work of "comparing output of executed code for you". Now I think that it would be cleanest to get a tool that would do nothing else but compare two streams and end with an error or regular message.
I imagine the API for workshoppers like this:
And the API for the compare should tool like this:
The output should be
Note: If one stream has less lines than the other it should write
__EOF__
to indicate that the file ended.This could replace the way we do comparison now. Anyone up for that?
The text was updated successfully, but these errors were encountered: