|
325 | 325 | {:id @id* :ns "xyz" :status ["done"]})
|
326 | 326 |
|
327 | 327 | (client-send! client {:id (id-inc!) :op "eval" :code "(/ 3 0)"})
|
328 |
| - (is (= {:id @id* :err "ZeroDivisionError('Fraction(3, 0)')"} (client-recv! client))) |
| 328 | + (let [{:keys [id err]} (client-recv! client)] |
| 329 | + (is (= id @id* )) |
| 330 | + (is (str/includes? err "ZeroDivisionError: Fraction(3, 0)"))) |
329 | 331 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
330 | 332 | (is (= @id* id))
|
331 | 333 | (is (= "xyz" ns))
|
|
337 | 339 | (client-send! client {:id (id-inc!) :op "eval" :code "(println :hey)\n(/ 4 0)"})
|
338 | 340 | (are [response] (= response (client-recv! client))
|
339 | 341 | {:id @id* :out ":hey"}
|
340 |
| - {:id @id* :out os/linesep} |
341 |
| - {:id @id* :err "ZeroDivisionError('Fraction(4, 0)')"}) |
| 342 | + {:id @id* :out os/linesep}) |
| 343 | + (let [{:keys [id err]} (client-recv! client)] |
| 344 | + (is (= @id* id)) |
| 345 | + (is (str/includes? err "ZeroDivisionError: Fraction(4, 0)"))) |
342 | 346 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
343 | 347 | (is (= @id* id))
|
344 | 348 | (is (= "xyz" ns))
|
|
347 | 351 | (are [response] (= response (client-recv! client))
|
348 | 352 | {:id @id* :ns "xyz" :status ["done"]})
|
349 | 353 |
|
350 |
| - (client-send! client {:id (id-inc!) :op "eval" :code "[*1 *2 *3 *e]"}) |
| 354 | + (client-send! client {:id (id-inc!) :op "eval" :code "[*1 *2 *3]"}) |
351 | 355 | (are [response] (= response (client-recv! client))
|
352 |
| - {:id @id* :ns "xyz" :value "[6 nil 4 ZeroDivisionError('Fraction(4, 0)')]"} |
| 356 | + {:id @id* :ns "xyz" :value "[6 nil 4]"} |
353 | 357 | {:id @id* :ns "xyz" :status ["done"]})
|
354 | 358 |
|
| 359 | + (client-send! client {:id (id-inc!) :op "eval" :code "*e"}) |
| 360 | + (let [{:keys [id value]} (client-recv! client)] |
| 361 | + (is (= @id* id)) |
| 362 | + (is (str/includes? value "ZeroDivisionError: Fraction(4, 0)"))) |
| 363 | + (is (= {:id @id* :ns "xyz" :status ["done"]} (client-recv! client))) |
| 364 | + |
355 | 365 | ;; error with :file
|
356 | 366 | (client-send! client {:id (id-inc!) :op "eval" :file "/hey/you.lpy" :code "1\n2\n(/ 5 0)"})
|
357 |
| - (are [response] (= response (client-recv! client)) |
358 |
| - {:id @id* :err "ZeroDivisionError('Fraction(5, 0)')"}) |
| 367 | + (let [{:keys [id err]} (client-recv! client)] |
| 368 | + (is (= @id* id)) |
| 369 | + (is (str/includes? err "ZeroDivisionError: Fraction(5, 0)"))) |
359 | 370 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
360 | 371 | (is (= @id* id))
|
361 | 372 | (is (= "xyz" ns))
|
362 | 373 | (is (= ["eval-error"] status))
|
363 | 374 | (is (not= -1 (.find ex "File \"/hey/you.lpy\", line 3")) ex))
|
364 | 375 | (are [response] (= response (client-recv! client))
|
365 | 376 | {:id @id* :ns "xyz" :status ["done"]})
|
366 |
| - |
367 | 377 | ;; error conditions
|
368 | 378 | (client-send! client {:id (id-inc!) :op "eval" :code "(xyz"})
|
369 | 379 | (let [{:keys [id err]} (client-recv! client)]
|
370 | 380 | (is (= @id* id))
|
371 |
| - (is (str/starts-with? err "basilisp.lang.reader.SyntaxError"))) |
| 381 | + (is (= ["" |
| 382 | + " exception: <class 'basilisp.lang.reader.UnexpectedEOFError'>" |
| 383 | + " message: Unexpected EOF in list" |
| 384 | + " line: 1:4"] |
| 385 | + (str/split-lines err)))) |
372 | 386 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
373 | 387 | (is (= @id* id))
|
374 | 388 | (is (= "xyz" ns))
|
|
378 | 392 | {:id @id* :ns "xyz" :status ["done"]})
|
379 | 393 |
|
380 | 394 | (client-send! client {:id (id-inc!) :op "eval" :code "(+ 3 5)" :ns "not-there"})
|
381 |
| - (is (= {:id @id* :err "CompilerException(msg=\"unable to resolve symbol '+' in this context\", phase=<CompilerPhase.ANALYZING: :analyzing>, filename='<nREPL Input>', form=+, lisp_ast=None, py_ast=None)"} (client-recv! client))) |
| 395 | + (let [{:keys [id err]} (client-recv! client)] |
| 396 | + (is (= id @id*)) |
| 397 | + (is (= ["" |
| 398 | + " exception: <class 'basilisp.lang.compiler.exception.CompilerException'>" |
| 399 | + " phase: :analyzing" |
| 400 | + " message: unable to resolve symbol '+' in this context" |
| 401 | + " form: +" |
| 402 | + " location: <nREPL Input>:1"] |
| 403 | + (str/split-lines err)))) |
382 | 404 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
383 | 405 | (is (= @id* id))
|
384 | 406 | (is (= "not-there" ns))
|
|
402 | 424 |
|
403 | 425 | ;; bad namespace
|
404 | 426 | (client-send! client {:id 3 :op "eval" :code "(+ 3 5)" :ns "#,,"})
|
405 |
| - (is (= {:id 3 :err "CompilerException(msg=\"unable to resolve symbol '+' in this context\", phase=<CompilerPhase.ANALYZING: :analyzing>, filename='<nREPL Input>', form=+, lisp_ast=None, py_ast=None)"} (client-recv! client))) |
| 427 | + (let [{:keys [id err]} (client-recv! client)] |
| 428 | + (is (= 3 id)) |
| 429 | + (is (= ["" |
| 430 | + " exception: <class 'basilisp.lang.compiler.exception.CompilerException'>" |
| 431 | + " phase: :analyzing" " message: unable to resolve symbol '+' in this context" |
| 432 | + " form: +" " location: <nREPL Input>:1"] |
| 433 | + (str/split-lines err)))) |
406 | 434 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
407 | 435 | (is (= 3 id))
|
408 | 436 | (is (= "#,," ns))
|
|
533 | 561 |
|
534 | 562 | (client-send! client {:id (id-inc!) :op "load-file" :ns "user" :file "(ns abc.third)\n\n(/ 3 0)"
|
535 | 563 | :file-name "third.lpy" :file-path "/abc/third.lpy"})
|
536 |
| - (is (= {:id @id* :err "ZeroDivisionError('Fraction(3, 0)')"} (client-recv! client))) |
| 564 | + (let [{:keys [id err]} (client-recv! client)] |
| 565 | + (is (= @id* id)) |
| 566 | + (is (str/includes? err "ZeroDivisionError: Fraction(3, 0)") (str/split-lines err))) |
537 | 567 | (let [{:keys [id ex status ns]} (client-recv! client)]
|
538 | 568 | (is (= @id* id))
|
539 | 569 | (is (= "abc.third" ns))
|
|
0 commit comments