space toplevel forms the way the source does
Every toplevel form was followed by a blank line whether or not one was written, so the prelude's run of typedefs arrived at twice the height. A function had no location of its own to measure from either, having lost it where its header and body are stitched together.
This commit is contained in:
@@ -633,4 +633,18 @@ compiles."
|
||||
(test-assert "nor is an aggregate tag"
|
||||
(emits? "(struct t ((z int))) (struct s ((a (¤ struct t))))" "struct t a[]"))
|
||||
(test-assert "nor one behind a pointer"
|
||||
(emits? "(struct t ((z int))) (struct s ((a (¤ * struct t))))" "struct t* a[]"))))
|
||||
(emits? "(struct t ((z int))) (struct s ((a (¤ * struct t))))" "struct t* a[]")))
|
||||
|
||||
;; Toplevel forms used to be separated by a blank line unconditionally,
|
||||
;; which spread a block of adjacent typedefs over twice the lines its
|
||||
;; author wrote
|
||||
(test-group "vertical spacing"
|
||||
(test-assert "adjacent forms stay adjacent"
|
||||
(emits? "(include a.h)\n(include b.h)" "#include <a.h>\n#include <b.h>"))
|
||||
(test-assert "a blank line is kept"
|
||||
(emits? "(include a.h)\n\n(include b.h)" "#include <a.h>\n\n#include <b.h>"))
|
||||
;; the gap is measured from where the form ended, not where it began
|
||||
(test-assert "a multi-line form does not invent one"
|
||||
(emits? "(struct s\n ((x int)))\n(include b.h)" "};\n#include <b.h>"))
|
||||
(test-assert "nor swallows one"
|
||||
(emits? "(struct s\n ((x int)))\n\n(include b.h)" "};\n\n#include <b.h>"))))
|
||||
|
||||
Reference in New Issue
Block a user