From 04d3a23e1cfc375f84a4a5d2fb9c01c104781ab7 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Wed, 18 Aug 2010 10:45:01 -0600 Subject: [PATCH] Removing unnecessary newlines and making tests newline accurate --- collects/datalog/eval.rkt | 2 +- collects/datalog/pretty.rkt | 7 +++---- collects/tests/datalog/eval.rkt | 14 +++++--------- collects/tests/datalog/examples/bidipath.txt | 1 - collects/tests/datalog/examples/path.txt | 1 - collects/tests/datalog/examples/revpath.txt | 1 - collects/tests/datalog/examples/sym.txt | 2 -- collects/tests/datalog/examples/tutorial.txt | 7 ------- collects/tests/datalog/paren-examples/add1.txt | 2 +- collects/tests/datalog/paren-examples/bidipath.txt | 1 - collects/tests/datalog/paren-examples/path.txt | 1 - collects/tests/datalog/paren-examples/revpath.txt | 1 - collects/tests/datalog/paren-examples/sym.txt | 2 -- collects/tests/datalog/paren-examples/tutorial.txt | 7 ------- 14 files changed, 10 insertions(+), 39 deletions(-) diff --git a/collects/datalog/eval.rkt b/collects/datalog/eval.rkt index 2bea9d00a8..c6d289ac4a 100644 --- a/collects/datalog/eval.rkt +++ b/collects/datalog/eval.rkt @@ -15,7 +15,7 @@ (datum->syntax #f (format-statement s) (assertion-srcloc s)))))) (define (print-questions ls) - (displayln + (displayln (format-questions ls))) (define (eval-program p) diff --git a/collects/datalog/pretty.rkt b/collects/datalog/pretty.rkt index 39f92f6418..9aaed2aa13 100644 --- a/collects/datalog/pretty.rkt +++ b/collects/datalog/pretty.rkt @@ -48,10 +48,9 @@ (format-external e)])) (define (format-questions ls) (v-concat - (append (map (lambda (l) - (h-append (format-question l) dot)) - ls) - (list line)))) + (map (lambda (l) + (h-append (format-question l) dot)) + ls))) (define (format-clause c) (if (empty? (clause-body c)) (format-literal (clause-head c)) diff --git a/collects/tests/datalog/eval.rkt b/collects/tests/datalog/eval.rkt index 3611fd5613..4cdf4b2d64 100644 --- a/collects/tests/datalog/eval.rkt +++ b/collects/tests/datalog/eval.rkt @@ -14,15 +14,11 @@ (define test-rkt (build-path examples-dir (format "~a.rkt" t))) (define test-txt (build-path examples-dir (format "~a.txt" t))) (test-equal? t - (filter (lambda (l) - (not (string=? l ""))) - (with-input-from-string - (with-output-to-string - (lambda () (dynamic-require test-rkt #f))) - port->lines)) - (filter (lambda (l) - (not (string=? l ""))) - (file->lines test-txt)))) + (with-input-from-string + (with-output-to-string + (lambda () (dynamic-require test-rkt #f))) + port->lines) + (file->lines test-txt))) (define (test-files d) (for ([f (in-list (directory-list d))] diff --git a/collects/tests/datalog/examples/bidipath.txt b/collects/tests/datalog/examples/bidipath.txt index 6c197dd6eb..f10d340c6a 100644 --- a/collects/tests/datalog/examples/bidipath.txt +++ b/collects/tests/datalog/examples/bidipath.txt @@ -14,4 +14,3 @@ path(d, d). path(d, c). path(d, b). path(d, a). - diff --git a/collects/tests/datalog/examples/path.txt b/collects/tests/datalog/examples/path.txt index 9319f8c51b..c014bcabbd 100644 --- a/collects/tests/datalog/examples/path.txt +++ b/collects/tests/datalog/examples/path.txt @@ -14,4 +14,3 @@ path(d, b). path(d, c). path(d, d). path(d, a). - diff --git a/collects/tests/datalog/examples/revpath.txt b/collects/tests/datalog/examples/revpath.txt index 6c197dd6eb..f10d340c6a 100644 --- a/collects/tests/datalog/examples/revpath.txt +++ b/collects/tests/datalog/examples/revpath.txt @@ -14,4 +14,3 @@ path(d, d). path(d, c). path(d, b). path(d, a). - diff --git a/collects/tests/datalog/examples/sym.txt b/collects/tests/datalog/examples/sym.txt index 15bc15f6a4..b410824089 100644 --- a/collects/tests/datalog/examples/sym.txt +++ b/collects/tests/datalog/examples/sym.txt @@ -4,5 +4,3 @@ perm(c, a). perm(b, a). perm(b, c). perm(c, b). - - diff --git a/collects/tests/datalog/examples/tutorial.txt b/collects/tests/datalog/examples/tutorial.txt index 629d2dc725..7171742106 100644 --- a/collects/tests/datalog/examples/tutorial.txt +++ b/collects/tests/datalog/examples/tutorial.txt @@ -1,26 +1,19 @@ parent(john, douglas). - parent(john, douglas). parent(bob, john). parent(ebbon, bob). - parent(john, douglas). - ancestor(ebbon, bob). ancestor(bob, john). ancestor(john, douglas). ancestor(bob, douglas). ancestor(ebbon, john). ancestor(ebbon, douglas). - ancestor(bob, john). ancestor(ebbon, john). - parent(john, douglas). parent(ebbon, bob). - ancestor(ebbon, bob). ancestor(john, douglas). - diff --git a/collects/tests/datalog/paren-examples/add1.txt b/collects/tests/datalog/paren-examples/add1.txt index dc6a141334..70700ca3bd 100644 --- a/collects/tests/datalog/paren-examples/add1.txt +++ b/collects/tests/datalog/paren-examples/add1.txt @@ -1,3 +1,3 @@ add1(2) = (3). - add2(1, 3). + diff --git a/collects/tests/datalog/paren-examples/bidipath.txt b/collects/tests/datalog/paren-examples/bidipath.txt index 6c197dd6eb..f10d340c6a 100644 --- a/collects/tests/datalog/paren-examples/bidipath.txt +++ b/collects/tests/datalog/paren-examples/bidipath.txt @@ -14,4 +14,3 @@ path(d, d). path(d, c). path(d, b). path(d, a). - diff --git a/collects/tests/datalog/paren-examples/path.txt b/collects/tests/datalog/paren-examples/path.txt index 9319f8c51b..c014bcabbd 100644 --- a/collects/tests/datalog/paren-examples/path.txt +++ b/collects/tests/datalog/paren-examples/path.txt @@ -14,4 +14,3 @@ path(d, b). path(d, c). path(d, d). path(d, a). - diff --git a/collects/tests/datalog/paren-examples/revpath.txt b/collects/tests/datalog/paren-examples/revpath.txt index 6c197dd6eb..f10d340c6a 100644 --- a/collects/tests/datalog/paren-examples/revpath.txt +++ b/collects/tests/datalog/paren-examples/revpath.txt @@ -14,4 +14,3 @@ path(d, d). path(d, c). path(d, b). path(d, a). - diff --git a/collects/tests/datalog/paren-examples/sym.txt b/collects/tests/datalog/paren-examples/sym.txt index 15bc15f6a4..b410824089 100644 --- a/collects/tests/datalog/paren-examples/sym.txt +++ b/collects/tests/datalog/paren-examples/sym.txt @@ -4,5 +4,3 @@ perm(c, a). perm(b, a). perm(b, c). perm(c, b). - - diff --git a/collects/tests/datalog/paren-examples/tutorial.txt b/collects/tests/datalog/paren-examples/tutorial.txt index 629d2dc725..7171742106 100644 --- a/collects/tests/datalog/paren-examples/tutorial.txt +++ b/collects/tests/datalog/paren-examples/tutorial.txt @@ -1,26 +1,19 @@ parent(john, douglas). - parent(john, douglas). parent(bob, john). parent(ebbon, bob). - parent(john, douglas). - ancestor(ebbon, bob). ancestor(bob, john). ancestor(john, douglas). ancestor(bob, douglas). ancestor(ebbon, john). ancestor(ebbon, douglas). - ancestor(bob, john). ancestor(ebbon, john). - parent(john, douglas). parent(ebbon, bob). - ancestor(ebbon, bob). ancestor(john, douglas). -