Skip to content

Commit

Permalink
Move regression test up to flow tests into a dedicated suite
Browse files Browse the repository at this point in the history
  • Loading branch information
countvajhula committed Jun 16, 2024
1 parent f3e3a65 commit 7f0032d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
19 changes: 1 addition & 18 deletions qi-test/tests/compiler/rules/full-cycle.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
syntax/macro-testing
qi/flow/core/deforest
qi/flow/core/compiler
racket/sandbox
"private/deforest-util.rkt"
(submod qi/flow/extended/expander invoke))

Expand All @@ -34,23 +33,7 @@
(deforested?
(phase1-eval
(qi-compile
#'(~>> (filter odd?) values (map sqr)))))))
(test-suite
"sandboxed evaluation"
(test-not-exn "Plays well with sandboxed evaluation"
;; This test reproduces the bug and the fix fixes it. Yet,
;; coverage does not show the lambda in `my-emit-local-step`
;; as being covered. This could be because the constructed
;; sandbox evaluator "covering" the code doesn't count as
;; coverage by the main evaluator running the test?
;; We address this by putting `my-emit-local-step` in a
;; submodule, which, by default, are ignored by coverage.
(lambda ()
(let ([eval (make-evaluator
'racket/base
'(require qi))])
(eval
'(~> (3) (* 2) add1))))))))
#'(~>> (filter odd?) values (map sqr)))))))))

(module+ main
(void
Expand Down
25 changes: 24 additions & 1 deletion qi-test/tests/flow.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
racket/string
racket/function
racket/format
racket/sandbox
(except-in "private/util.rkt"
add-two)
syntax/macro-testing)
Expand Down Expand Up @@ -1657,7 +1658,29 @@
(thunk
((☯ (== _ _ _))
3)))
(test-equal? "relay-_" ((☯ _) 3) 3))))))
(test-equal? "relay-_" ((☯ _) 3) 3))))

(test-suite
"regression tests"
(test-suite
"sandboxed evaluation"
(test-not-exn "Plays well with sandboxed evaluation"
;; See "Breaking Out of the Sandbox"
;; https://github.com/drym-org/qi/wiki/Qi-Meeting-Mar-29-2024
;;
;; This test reproduces the bug and the fix fixes it. Yet,
;; coverage does not show the lambda in `my-emit-local-step`
;; as being covered. This could be because the constructed
;; sandbox evaluator "covering" the code doesn't count as
;; coverage by the main evaluator running the test?
;; We address this by putting `my-emit-local-step` in a
;; submodule, which, by default, are ignored by coverage.
(lambda ()
(let ([eval (make-evaluator
'racket/base
'(require qi))])
(eval
'(☯ add1)))))))))

(module+ main
(void (run-tests tests)))

0 comments on commit 7f0032d

Please sign in to comment.