brownplt / ZZZ-captain-teach

Set sail for Learning Island! Deprecated and no longer maintained
5 stars 1 forks source link

Check/where statements do not work when code raises an empty string. #30

Closed allight closed 10 years ago

allight commented 10 years ago

Code that raises an empty string as an error in captain teach within a check or where clause is always reported to have passed the given test, even if it has not.

Example:

fun fail():
  raise("")
where:
  fail() is 1
  fail() is 2
  fail() raises ""
end
check:
  fail() is 1
  fail() is 2
  fail() raises ""
end

Result: All 6 tests pass Expected result: Tests 1, 2, 4 & 5 fail.

Note this does not affect a locally installed version of pyret, only captain teach, meaning it probably has to do with javascript.

jpolitz commented 10 years ago

Confirmed, looking into it.

jpolitz commented 10 years ago

I committed a cardinal sin in JavaScript; relying on truthy/falsiness of something that turned out to be a string. I originally intended for these always to be objects, but it turns out the raw string can appear here, and empty strings are falsy in JS.

https://github.com/brownplt/captain-teach/commit/3263e57ffe3ce2155f74a8ebeea8b3aab0e3676c

Darn.

jpolitz commented 10 years ago

(Pushed to the site).