leave an empty for slot empty
() went to C as NULL, so (for () () ()) tested false and never ran; it is for (;;).
This commit is contained in:
@@ -419,6 +419,14 @@ whitespace aside, THEN?"
|
||||
(test-assert "and a for with no body has them"
|
||||
(emits? (in-fn "(for (var i int 0) (< i a) (++ i))") "for (int i = 0; i < a; ++i) {}")))
|
||||
|
||||
;; an empty slot was the empty list, which C was told as NULL: the
|
||||
;; test of (for () () ()) was false, and the loop never ran
|
||||
(test-group "empty for slots"
|
||||
(test-assert "are empty"
|
||||
(emits? (in-fn "(for () () () (g a))") "for (;;) {"))
|
||||
(test-assert "any of them"
|
||||
(emits? (in-fn "(for () (< a 1) () (g a))") "for (; a < 1;) {")))
|
||||
|
||||
(test-group "malformed types are rejected"
|
||||
(test-assert "nested pointer chain"
|
||||
(reports? (in-fn "(var p (* (* char)))") "pointer chains are written flat"))
|
||||
|
||||
Reference in New Issue
Block a user