Pack your bags 2

Before posting about Leiningen I ought to have mentioned two other useful things that it does.

First, it supports a new command which sets up a project structure.

C:UsersCliveDesktoplein>lein.bat new test2
Created new project in: test2

C:UsersCliveDesktopleintest2>dir
Volume in drive C is ACER
Volume Serial Number is 2AA8-1BF3

Directory of C:UsersCliveDesktopleintest2

11/04/2010  22:10                24 .gitignore
11/04/2010  22:10               168 project.clj
11/04/2010  22:10               115 README
11/04/2010  22:10    <DIR>          src
11/04/2010  22:10    <DIR>          test

The test directory is set up to contain a sequence of unit tests.

C:UsersCliveDesktopleintest2testtest2>type core_test.clj
(ns test2.core-test
  (:use [test2.core] :reload-all)
  (:use [clojure.test]))

(deftest replace-me ;; FIXME: write
  (is false))

And the project file is set up to include the contrib project that contains the test framework.

C:UsersCliveDesktopleintest2>type project.clj
(defproject test2 "1.0.0-SNAPSHOT"
  :description "FIXME: write"
  :dependencies [[org.clojure/clojure "1.1.0"]
                 [org.clojure/clojure-contrib "1.1.0"]])

Leiningen will then run the unit tests using the test command.

C:UsersCliveDesktopleintest2>..lein.bat compile
Downloading: org/clojure/clojure/1.1.0/clojure-1.1.0.pom from central
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.pom from central
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.pom from clojure
Transferring 1K from clojure
Downloading: org/clojure/clojure/1.1.0/clojure-1.1.0.jar from central
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.jar from central
Downloading: org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.jar from clojure
Transferring 3215K from clojure
     [copy] Copying 2 files to C:UsersCliveDesktopleintest2lib
All :namespaces already compiled.

C:UsersCliveDesktopleintest2>..lein.bat test

Testing test2.core-test

FAIL in (replace-me) (core_test.clj:6)
expected: false
  actual: false

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.

——————–
Total:

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.

These functions look really useful.

Advertisements
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s