From 8bc79618cf6a84a6779afd2e8418cf99089a5ff1 Mon Sep 17 00:00:00 2001 From: Ted Pennings Date: Wed, 1 Jan 2014 15:37:53 -0500 Subject: leiningen: add a simple project for `brew test`. Closes #25589. Signed-off-by: Mike McQuaid --- Library/Formula/leiningen.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Library') diff --git a/Library/Formula/leiningen.rb b/Library/Formula/leiningen.rb index df84d7aa6..427040346 100644 --- a/Library/Formula/leiningen.rb +++ b/Library/Formula/leiningen.rb @@ -31,4 +31,28 @@ class Leiningen < Formula To play around with Clojure run `lein repl` or `lein help`. EOS end + + test do + (testpath/'project.clj').write <<-EOS.undent + (defproject brew-test "1.0" + :dependencies [[org.clojure/clojure "1.5.1"]]) + EOS + (testpath/'src/brew_test/core.clj').write <<-EOS.undent + (ns brew-test.core) + (defn adds-two + "I add two to a number" + [x] + (+ x 2)) + EOS + (testpath/'test/brew_test/core_test.clj').write <<-EOS.undent + (ns brew-test.core-test + (:require [clojure.test :refer :all] + [brew-test.core :refer :all])) + (deftest canary-test + (testing "adds-two yields 4 for input of 2" + (is (= 4 (adds-two 2))))) + EOS + system "#{bin}/lein", 'test' + end + end -- cgit v1.2.3