[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-648-g70bd8a8

Mildred Ki'Lya silkensedai at online.fr
Sat Sep 4 08:23:56 UTC 2010


The following commit has been merged in the master branch:
commit 70bd8a8a16063ee71a415b503b67caba587cb289
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Sat Sep 4 10:07:42 2010 +0200

    Tidy tests

diff --git a/.gitignore b/.gitignore
index c018c76..31493b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,5 @@
 /doc/
 /bootstrap/
 /Markdown.pl
+/.cucumber-rerun.txt
+/tmp/
diff --git a/Makefile b/Makefile
index 52c3f21..4266d94 100644
--- a/Makefile
+++ b/Makefile
@@ -196,6 +196,38 @@ clean-spaces:
 src/HACKING.html: src/HACKING Markdown.pl
 	$(MARKDOWN_CMDLINE)
 
+### Cucumber tests ###
+
+run-cucumber-wip:
+	@echo
+	@echo "#########################################"
+	@echo "##  Run cucumber for work in progress  ##"
+	@echo "#########################################"
+	@echo
+	cucumber -w -f progress -t '~@bootstrap' -t '@wip' features/*.feature
+
+run-cucumber:
+	@echo
+	@echo "##########################"
+	@echo "##  Run cucumber tests  ##"
+	@echo "##########################"
+	@echo
+	cucumber -f progress -f rerun -o .cucumber-rerun.txt -t '~@bootstrap' -t '~@wip' features/*.feature
+
+rerun-cucumber:
+	@echo
+	@echo "##########################################"
+	@echo "##  Run cucumber scenarios that failed  ##"
+	@echo "##########################################"
+	@echo
+	@touch .cucumber-rerun.txt
+	@if [ -s .cucumber-rerun.txt ]; then \
+		cucumber @.cucumber-rerun.txt; \
+	fi
+	@-$(RM) -f .cucumber-rerun.txt
+
+.PHONY: run-cucumber run-cucumber-wip rerun-cucumber
+
 ### Code coverage ###
 
 lisaac-cov: path.h bin/lisaac
@@ -206,7 +238,7 @@ cov-clean:
 	-$(RM) -f lisaac-cov.cov
 	-cp lisaac-cov.cov.orig lisaac-cov.cov
 cov: lisaac-cov
-	-CUKE_LISAAC_NAME=lisaac-cov cucumber -f progress -t ~@bootstrap features/*.feature
+	-CUKE_LISAAC_NAME=lisaac-cov cucumber -f progress -f rerun -o .cucumber-rerun.txt -t '~@bootstrap' -t '~@wip' features/*.feature
 cov-report:
 	mkdir -p features/coverage-report
 	tools/licoverage --html -o features/coverage-report -e '\.lip$$' -e '/lib/' lisaac-cov.cov
diff --git a/README.testing b/README.testing
new file mode 100644
index 0000000..7e40f9f
--- /dev/null
+++ b/README.testing
@@ -0,0 +1,24 @@
+Testing
+=======
+
+Tests are executed using [cucumber](http://cukes.info). You'll need to install
+it to be able to run tests. On an unix machine where you have ruby gems
+installed, just run:
+
+    gem install cucumber
+
+From now on, you can run tgests by running:
+
+    make run-cucumber
+    make run-cucumber-wip
+    make rerun-cucumber
+
+The different targets do different things:
+
+* `run-cucumber`:     Run cucumber tests, not verbose
+* `rerun-cucumber`:   Run cucumber tests that failed at full verbosity
+* `run-cucumber-wip`: Run cucumber tests that represents features that are work
+                      in progress (scenarios taggede with @wip)
+
+Tests are in the directory `features/` and have the suffix `.feature`. The
+syntax is very simple.
diff --git a/features/bootstrap.feature b/features/bootstrap.feature
index 357e744..d7a01e5 100644
--- a/features/bootstrap.feature
+++ b/features/bootstrap.feature
@@ -1,3 +1,4 @@
+ at bootstrap
 Feature: Bootstrapping
   In order to have a self hosting compiler
   As a Lisaac devlopper
@@ -5,25 +6,26 @@ Feature: Bootstrapping
 
   Background:
     Given I am in the lisaac directory
-    And   lisaac/ is in the PATH
-    And   make.lip is installed
-    And   a file "tmp/path.h" constructed with:
+      And lisaac/ is in the PATH
+      And make.lip is installed
+      And a file "tmp/path.h" constructed with:
       """
       printf '#define LISAAC_DIRECTORY "%s"\n' "`pwd`"
       """
 
-  @bootstrap
   Scenario:
     Given I am in "tmp/"
-    When  I run lisaac ../src/make.lip -compiler -optim -o lisaac1
-    Then  it should pass
-    And   "lisaac1.c" should exist
-    And   "lisaac1" should exist
-    When  I run ./lisaac1 ../src/make.lip -compiler -optim -o lisaac2
-    Then  it should pass
-    And   "lisaac2.c" should exist
-    And   "lisaac2" should exist
-    When  I run ./lisaac2 ../src/make.lip -compiler -optim -o lisaac3
-    Then  it should pass
-    And   "lisaac3.c" should exist
-    And   "lisaac3" should exist
+     When I run lisaac ../src/make.lip -compiler -optim -o lisaac1
+     Then it should pass
+      And "lisaac1.c" should exist
+      And "lisaac1" should exist
+
+     When I run ./lisaac1 ../src/make.lip -compiler -optim -o lisaac2
+     Then it should pass
+      And "lisaac2.c" should exist
+      And "lisaac2" should exist
+
+     When I run ./lisaac2 ../src/make.lip -compiler -optim -o lisaac3
+     Then it should pass
+      And "lisaac3.c" should exist
+      And "lisaac3" should exist
diff --git a/features/contracts.feature b/features/contracts.feature
index e053191..b55231e 100644
--- a/features/contracts.feature
+++ b/features/contracts.feature
@@ -21,7 +21,7 @@ Feature: Execute contracts
   Background:
     Given I am in an empty directory
 
-  @fail
+  @fail @wip
   Scenario: simple contracts
     Given a file "simple.li"
       """
diff --git a/features/cyclic-inheritance.feature b/features/cyclic-inheritance.feature
index 7ac3ca9..322cb2c 100644
--- a/features/cyclic-inheritance.feature
+++ b/features/cyclic-inheritance.feature
@@ -5,6 +5,7 @@ Feature: Cyclic inheritance
   Background:
     Given I am in an empty directory
 
+  @wip
   Scenario: Basic
     Given a file "cyclic.li":
       """
diff --git a/features/dynamic-inheritance.feature b/features/dynamic-inheritance.feature
index 61cc6ee..b463f8b 100644
--- a/features/dynamic-inheritance.feature
+++ b/features/dynamic-inheritance.feature
@@ -1,5 +1,6 @@
 Feature: Dynamic Inheritance
 
+  @wip
   Scenario:
     Given I am in an empty directory
     And   a file "hello.li":
diff --git a/features/expanded.feature b/features/expanded.feature
index 0b7bd1b..623f125 100644
--- a/features/expanded.feature
+++ b/features/expanded.feature
@@ -13,6 +13,7 @@ Feature: Expanded Objects
   Background:
     Given I am in an empty directory
 
+  @wip
   Scenario:
     Given a file "aa.li"
       """
diff --git a/features/hello-world.feature b/features/hello-world.feature
index 5b8ff76..c3b81c4 100644
--- a/features/hello-world.feature
+++ b/features/hello-world.feature
@@ -5,12 +5,12 @@ Feature: Hello World
 
   Scenario: Debug
     Given I am in an empty directory
-    When I run pwd
-    And  I print the last command output
-    When I run which lisaac
-    And  I print the last command output
-    When I run echo $PATH
-    And  I print the last command output
+    #When I run pwd
+     #And I print the last command output
+     #And I run which lisaac
+     #And I print the last command output
+     #And I run echo $PATH
+     #And I print the last command output
 
   Scenario: Compile Hello World
     Given I am in an empty directory
diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb
index 676dc13..8958c47 100644
--- a/features/step_definitions/steps.rb
+++ b/features/step_definitions/steps.rb
@@ -20,7 +20,7 @@ Given /^I am in an empty directory$/ do
   FileUtils.cd(dir);
 end
 
-Given /^I am in the lisaac directory$/ do |dir|
+Given /^I am in the lisaac directory$/ do
   @oldcwd = FileUtils.pwd();
   FileUtils.cd($lisaac_path);
 end

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list