diff --git a/.classpath b/.classpath
deleted file mode 100644
index de63c7f..0000000
--- a/.classpath
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
index 6257025..4b9f633 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,12 @@
+.idea/**/libraries
+.idea/**/tasks.xml
+.idea/**/workspace.xml
+.idea/dictionaries
fitnesse/FitNesseRoot/files
fitnesse/FitNesseRoot/FitNesse/UserGuide/
fitnesse/fitnesse-results
target/
+*.iml
*.swp
*.zip
-dependency-reduced-pom.xml
\ No newline at end of file
+dependency-reduced-pom.xml
diff --git a/.idea/ClojureProjectResolveSettings.xml b/.idea/ClojureProjectResolveSettings.xml
new file mode 100644
index 0000000..df470b1
--- /dev/null
+++ b/.idea/ClojureProjectResolveSettings.xml
@@ -0,0 +1,6 @@
+
+
+
+ IDE
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..d619137
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..940db4f
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..e2a4e14
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..b26911b
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..2a51304
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..5806fb3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d30d09e
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..08fa5bd
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Build.xml b/.idea/runConfigurations/Build.xml
new file mode 100644
index 0000000..0656015
--- /dev/null
+++ b/.idea/runConfigurations/Build.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/FitNesse.xml b/.idea/runConfigurations/FitNesse.xml
new file mode 100644
index 0000000..8ddf06f
--- /dev/null
+++ b/.idea/runConfigurations/FitNesse.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Test.xml b/.idea/runConfigurations/Test.xml
new file mode 100644
index 0000000..0c0fc6e
--- /dev/null
+++ b/.idea/runConfigurations/Test.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.project b/.project
deleted file mode 100644
index d3d6477..0000000
--- a/.project
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
- Transcendental Lisp
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.wst.common.project.facet.core.builder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
-
- org.eclipse.m2e.core.maven2Nature
- org.eclipse.wst.common.project.facet.core.nature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/.settings/FitNesse.launch b/.settings/FitNesse.launch
deleted file mode 100644
index 7cca533..0000000
--- a/.settings/FitNesse.launch
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/.settings/Transcendental Lisp.launch b/.settings/Transcendental Lisp.launch
deleted file mode 100644
index d9e521e..0000000
--- a/.settings/Transcendental Lisp.launch
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.settings/clean verify.launch b/.settings/clean verify.launch
deleted file mode 100644
index 5ea1e4d..0000000
--- a/.settings/clean verify.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 911ca7a..0000000
--- a/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-eclipse.preferences.version=1
-encoding//lisp/lang=UTF-8
-encoding/=UTF-8
-encoding/src=UTF-8
-encoding/test=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 13b3428..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f..0000000
--- a/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/content.txt
index 6d9cd40..c3b94a3 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/content.txt
@@ -1,12 +1,12 @@
-There are cases when you want to copy and append the last row of your column or row fixture certain number of times.
-
-For Ex: We make a query to the database and it return certain record 'n' number of times. Instead of writing the same record 'n' number of times in your fitnesse page, you can just specify that you expect the last column 'n' number of times using the !-CopyAndAppendLastRow-! decorator.
-
-!|Copy and Append Last Row|100|number of times|
-|Division|
-|numerator|denominator|quotient()|
-|10|2|5|
-|12.6|3|4.2|
-|100|4|25|
-
-In the above example, we want to divide 100 by 4 101 times.
+There are cases when you want to copy and append the last row of your column or row fixture certain number of times.
+
+For Ex: We make a query to the database and it return certain record 'n' number of times. Instead of writing the same record 'n' number of times in your fitnesse page, you can just specify that you expect the last column 'n' number of times using the !-CopyAndAppendLastRow-! decorator.
+
+!|Copy and Append Last Row|100|number of times|
+|Division|
+|numerator|denominator|quotient()|
+|10|2|5|
+|12.6|3|4.2|
+|100|4|25|
+
+In the above example, we want to divide 100 by 4 101 times.
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/properties.xml
index 4646681..11ec60d 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAndAppendLastRow/properties.xml
@@ -1,13 +1,13 @@
-
-
-
-
- 20061216213113
-
-
-
-
- 1166322673244
-
- 524008525574625139
-
+
+
+
+
+ 20061216213113
+
+
+
+
+ 1166322673244
+
+ 524008525574625139
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/content.txt
index 58c220f..2f3a42e 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/content.txt
@@ -1,12 +1,12 @@
-What if you want to call the fixture 'n' times with the same row except you want to update one or two column's value?
-
-Ex: If you are using fitnesse fixtures to populate database and you want to insert a record 500 times. It would be easy to write one model record and insert that 500 times. This can be easily done with the !-CopyAndAppendLastRow-! decorator. But the database table might have a primary key. So you might want to update the primary key in each row. Now you might want to pipe !-IncrementColumnsValue-! and !-CopyAndAppendLastRow-! decorators to get the job done.
-
-Here is an example where I want to divide 5 by 1, 100 times, but I also want to update the numerator by 5 and denominator by 1.
-
-!|Copy and Append Last Row|100|times|
-|Increment Columns Value|numerator|of type|int|by|5|
-|Increment Columns Value|denominator|of type|int|by|1|
-|Division|
-|numerator|denominator|quotient()|
-|5|1|5|
+What if you want to call the fixture 'n' times with the same row except you want to update one or two column's value?
+
+Ex: If you are using fitnesse fixtures to populate database and you want to insert a record 500 times. It would be easy to write one model record and insert that 500 times. This can be easily done with the !-CopyAndAppendLastRow-! decorator. But the database table might have a primary key. So you might want to update the primary key in each row. Now you might want to pipe !-IncrementColumnsValue-! and !-CopyAndAppendLastRow-! decorators to get the job done.
+
+Here is an example where I want to divide 5 by 1, 100 times, but I also want to update the numerator by 5 and denominator by 1.
+
+!|Copy and Append Last Row|100|times|
+|Increment Columns Value|numerator|of type|int|by|5|
+|Increment Columns Value|denominator|of type|int|by|1|
+|Division|
+|numerator|denominator|quotient()|
+|5|1|5|
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/properties.xml
index 248425b..6c8103c 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/CopyAppendLastRowAndIncrementColumnValues/properties.xml
@@ -1,13 +1,13 @@
-
-
-
-
- 20061216215829
-
-
-
-
- 1166324308994
-
- -8528063939302055872
-
+
+
+
+
+ 20061216215829
+
+
+
+
+ 1166324308994
+
+ -8528063939302055872
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/content.txt
index 6bf4596..8327a35 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/content.txt
@@ -1,4 +1,4 @@
-!|Import|
-|fit.decorator|
-|fit.decorator.performance|
-|eg|
+!|Import|
+|fit.decorator|
+|fit.decorator.performance|
+|eg|
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/properties.xml
index 47bf822..e92b349 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/SetUp/properties.xml
@@ -1,14 +1,14 @@
-
-
- true
- true
- 20061216183948
- true
- true
- true
- true
- true
- true
- 1166312388007
- -6757238585913794424
-
+
+
+ true
+ true
+ 20061216183948
+ true
+ true
+ true
+ true
+ true
+ true
+ 1166312388007
+ -6757238585913794424
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/content.txt
index 7931d99..c69b2ee 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/content.txt
@@ -1 +1 @@
-!|fit.Summary|
+!|fit.Summary|
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/properties.xml
index b7f5c22..e825712 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteFitDecoratorTests/TearDown/properties.xml
@@ -1,14 +1,14 @@
-
-
- true
- true
- 20061216141632
- true
- true
- true
- true
- true
- true
- 1166296592283
- -5128325404176707243
-
+
+
+ true
+ true
+ 20061216141632
+ true
+ true
+ true
+ true
+ true
+ true
+ 1166296592283
+ -5128325404176707243
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/content.txt
index b10df64..4aba643 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/content.txt
@@ -1,145 +1,145 @@
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-
-
-Test Strings by plain compare, neither custom compare nor regular expression.
-In this case detailed diff is wanted.
-
-| Detailed Diff |
-| actual string | expected string? | #comment |
-| abc | abc | equal |
-| abc | xyz | completly different |
-| abc | xbc | first char different |
-| abc | ayc | middle char different |
-| abc | abz | last char different |
-| | xyz | actual empty, expected filled |
-| abc | | actual filled, expected empty; will be counted as ignored |
-| <&> | <&> | equal with HTML special chars |
-| <&> | xyz | completly different with HTML special chars |
-| <&> | x&> | first char different with HTML special chars |
-| <&> | | middle char different with HTML special chars |
-| <&> | <&z | last char differentwith HTML special chars |
-| | <&> | actual empty, expected filled with HTML special chars |
-| abc | <&> | completly different with HTML special chars |
-| abc | | last char different with HTML special chars |
-| Hello World | Wellcome Lord | no obvious match |
-
-Test Strings by regular expression.
-In this case no detailed diff is wanted.
-
-| Detailed Diff |
-| actual string | expected string? | #comment |
-| abc | =~/abc/ | match |
-| abc | =~/a.c/ | match |
-| abc | =~/\w+/ | match |
-| abc | =~/\w{3}/ | match |
-| abc | =~/^\w{3}$/ | match |
-| abc | =~/\w{1}/ | match |
-| abc | =~/^\w{1}$/ | no match |
-| abc | =~/[ABC]+/ | no match |
-| abc | =~/[ABC]+/i | wrong syntax, disable value comparison, use string comparison |
-
-
-Test integers by string comparison.
-In this case detailed diff ist wanted.
-
-| Detailed Diff |
-| actual int | expected int? | #comment |
-| 1 | 1 | equal |
-| 1 | 2 | completly different |
-| 1 | 10 | partially different |
-| | 1 | completly different |
-
-Test integers by value comparison, see =1 | ok |
-| 1 | <2 | ok |
-| 1 | >1 | nok |
-| 1 | =1 | ok |
-| 1 | <1 | nok |
-| 1 | 0<_<2 | ok |
-| 1 | 2<_<0 | nok, logically wrong |
-| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
-| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
-
-
-Test doubles by string comparison.
-In this case detailed diff ist wanted.
-
-| Detailed Diff |
-| actual double | expected double? | #comment |
-| 1.0 | 1.0 | equal |
-| 1.1 | 222 | completly different |
-| 1.0 | 10 | partially different |
-| | 1.0 | partially different |
-
-Test doubles by value comparison, see =1 | ok |
-| 1 | <2 | ok |
-| 1 | >1 | nok |
-| 1 | =1 | ok |
-| 1 | <1 | nok |
-| 1 | 0<_<2 | ok |
-| 1 | 2<_<0 | nok, logically wrong |
-| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
-| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
-| 1.0 | ~=1 | ok |
-| 1.1 | ~=1 | ok |
-| 0.9 | ~=1 | ok |
-| 1.0 | ~=1.0 | ok |
-| 1.1 | ~=1.0 | nok |
-| 0.9 | ~=1.0 | nok |
-
-
-Test symbols by string comparison.
-
-| Detailed Diff |
-| actual symbol | expected symbol? | #comment |
-| abc | $symbol= | |
-| $symbol | abc | |
-| $symbol | xyz | |
-| $symbol | xbc | |
-| $symbol | ayc | |
-| $symbol | abz | |
-| abc | $symbol | |
-| xyz | $symbol | |
-| xbc | $symbol | |
-| ayc | $symbol | |
-| abz | $symbol | |
-| | $symbol | |
-
-
-Test custom comparator, see FitNesse.UserGuide.AdministeringFitNesse.ConfigurationFile
-The inverse comparator fitnesse.slim.test.InverseComparator negates the method String.equals(String).
-
-| script | Detailed Diff |
-| note | everything not equals to 'abc' is ok |
-| check | echo | abc | inverse:xyz |
-| note | everything not equals to 'abc' is ok |
-| check | echo | abc | inverse:ABC |
-| note | everthing not equals to 'abc' is ok |
-| check | echo | abc | inverse:cba |
-| note | only 'abc' is nok |
-| check | echo | abc | inverse:abc |
-
-
-Test Scenario and Script
-
-!| Scenario | Detailed Diff Scenario Test |
-| start | Detailed Diff |
-| check | echo | hello | hello |
-| check | echo | hello | hallo |
-
-!| Script |
-| Detailed Diff Scenario Test |
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+
+
+Test Strings by plain compare, neither custom compare nor regular expression.
+In this case detailed diff is wanted.
+
+| Detailed Diff |
+| actual string | expected string? | #comment |
+| abc | abc | equal |
+| abc | xyz | completly different |
+| abc | xbc | first char different |
+| abc | ayc | middle char different |
+| abc | abz | last char different |
+| | xyz | actual empty, expected filled |
+| abc | | actual filled, expected empty; will be counted as ignored |
+| <&> | <&> | equal with HTML special chars |
+| <&> | xyz | completly different with HTML special chars |
+| <&> | x&> | first char different with HTML special chars |
+| <&> | | middle char different with HTML special chars |
+| <&> | <&z | last char differentwith HTML special chars |
+| | <&> | actual empty, expected filled with HTML special chars |
+| abc | <&> | completly different with HTML special chars |
+| abc | | last char different with HTML special chars |
+| Hello World | Wellcome Lord | no obvious match |
+
+Test Strings by regular expression.
+In this case no detailed diff is wanted.
+
+| Detailed Diff |
+| actual string | expected string? | #comment |
+| abc | =~/abc/ | match |
+| abc | =~/a.c/ | match |
+| abc | =~/\w+/ | match |
+| abc | =~/\w{3}/ | match |
+| abc | =~/^\w{3}$/ | match |
+| abc | =~/\w{1}/ | match |
+| abc | =~/^\w{1}$/ | no match |
+| abc | =~/[ABC]+/ | no match |
+| abc | =~/[ABC]+/i | wrong syntax, disable value comparison, use string comparison |
+
+
+Test integers by string comparison.
+In this case detailed diff ist wanted.
+
+| Detailed Diff |
+| actual int | expected int? | #comment |
+| 1 | 1 | equal |
+| 1 | 2 | completly different |
+| 1 | 10 | partially different |
+| | 1 | completly different |
+
+Test integers by value comparison, see =1 | ok |
+| 1 | <2 | ok |
+| 1 | >1 | nok |
+| 1 | =1 | ok |
+| 1 | <1 | nok |
+| 1 | 0<_<2 | ok |
+| 1 | 2<_<0 | nok, logically wrong |
+| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
+| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
+
+
+Test doubles by string comparison.
+In this case detailed diff ist wanted.
+
+| Detailed Diff |
+| actual double | expected double? | #comment |
+| 1.0 | 1.0 | equal |
+| 1.1 | 222 | completly different |
+| 1.0 | 10 | partially different |
+| | 1.0 | partially different |
+
+Test doubles by value comparison, see =1 | ok |
+| 1 | <2 | ok |
+| 1 | >1 | nok |
+| 1 | =1 | ok |
+| 1 | <1 | nok |
+| 1 | 0<_<2 | ok |
+| 1 | 2<_<0 | nok, logically wrong |
+| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
+| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
+| 1.0 | ~=1 | ok |
+| 1.1 | ~=1 | ok |
+| 0.9 | ~=1 | ok |
+| 1.0 | ~=1.0 | ok |
+| 1.1 | ~=1.0 | nok |
+| 0.9 | ~=1.0 | nok |
+
+
+Test symbols by string comparison.
+
+| Detailed Diff |
+| actual symbol | expected symbol? | #comment |
+| abc | $symbol= | |
+| $symbol | abc | |
+| $symbol | xyz | |
+| $symbol | xbc | |
+| $symbol | ayc | |
+| $symbol | abz | |
+| abc | $symbol | |
+| xyz | $symbol | |
+| xbc | $symbol | |
+| ayc | $symbol | |
+| abz | $symbol | |
+| | $symbol | |
+
+
+Test custom comparator, see FitNesse.UserGuide.AdministeringFitNesse.ConfigurationFile
+The inverse comparator fitnesse.slim.test.InverseComparator negates the method String.equals(String).
+
+| script | Detailed Diff |
+| note | everything not equals to 'abc' is ok |
+| check | echo | abc | inverse:xyz |
+| note | everything not equals to 'abc' is ok |
+| check | echo | abc | inverse:ABC |
+| note | everthing not equals to 'abc' is ok |
+| check | echo | abc | inverse:cba |
+| note | only 'abc' is nok |
+| check | echo | abc | inverse:abc |
+
+
+Test Scenario and Script
+
+!| Scenario | Detailed Diff Scenario Test |
+| start | Detailed Diff |
+| check | echo | hello | hello |
+| check | echo | hello | hallo |
+
+!| Script |
+| Detailed Diff Scenario Test |
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/properties.xml
index 8109798..ecd29df 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/TestPage/properties.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/content.txt
index fa4783d..640ac1c 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/content.txt
@@ -1,230 +1,230 @@
-!define TEST_SYSTEM {slim}
-
-!3 Diff of failed tests
-
-!4 Original intentionally failing tests
-
-The subordinate page >TestPage collects the following tests. The page is disabled because of many tests fails intentionally. It is useful for manual tests only.
-
-!4 Test wrapper for test
-
-!*> Tests for type string
-
-!| script |
-|given page|TestPage|with content|${SUT_PATH} !-
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-
-Test Strings by plain compare, neither custom compare nor regular expression.
-In this case detailed diff is wanted.
-
-| Detailed Diff |
-| actual string | expected string? | #comment |
-| abc | abc | equal |
-| abc | xyz | completly different |
-| abc | xbc | first char different |
-| abc | ayc | middle char different |
-| abc | abz | last char different |
-| | xyz | actual empty, expected filled |
-| abc | | actual filled, expected empty; will be counted as ignored |
-| <&> | <&> | equal with HTML special chars |
-| <&> | xyz | completly different with HTML special chars |
-| <&> | x&> | first char different with HTML special chars |
-| <&> | | middle char different with HTML special chars |
-| <&> | <&z | last char differentwith HTML special chars |
-| | <&> | actual empty, expected filled with HTML special chars |
-| abc | <&> | completly different with HTML special chars |
-| abc | | last char different with HTML special chars |
-| Hello World | Wellcome Lord | no obvious match |
-
-Test Strings by regular expression.
-In this case no detailed diff is wanted.
-
-| Detailed Diff |
-| actual string | expected string? | #comment |
-| abc | =~/abc/ | match |
-| abc | =~/a.c/ | match |
-| abc | =~/\w+/ | match |
-| abc | =~/\w{3}/ | match |
-| abc | =~/^\w{3}$/ | match |
-| abc | =~/\w{1}/ | match |
-| abc | =~/^\w{1}$/ | no match |
-| abc | =~/[ABC]+/ | no match |
-| abc | =~/[ABC]+/i | wrong syntax, disable value comparison, use string comparison |
--!|
-|test results for page|TestPage|should contain|!-abc-!|
-|test results for page|TestPage|should contain|!-[abc] expected [xyz]-!|
-|test results for page|TestPage|should contain|!-[abc] expected [xbc]-!|
-|test results for page|TestPage|should contain|!-[abc] expected [ayc]-!|
-|test results for page|TestPage|should contain|!-[abc] expected [abz]-!|
-|test results for page|TestPage|should contain|!-[] expected [xyz]-!|
-|test results for page|TestPage|should contain|!-[Hello World] expected [Wellcome Lord]-!|
-*!
-
-!*> Tests for type int
-
-!| script |
-|given page|TestPage|with content|${SUT_PATH} !-
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-
-Test integers by string comparison.
-In this case detailed diff ist wanted.
-
-| Detailed Diff |
-| actual int | expected int? | #comment |
-| 1 | 1 | equal |
-| 1 | 2 | completly different |
-| 1 | 10 | partially different |
-| | 1 | completly different |
-
-Test integers by value comparison, see =1 | ok |
-| 1 | <2 | ok |
-| 1 | >1 | nok |
-| 1 | =1 | ok |
-| 1 | <1 | nok |
-| 1 | 0<_<2 | ok |
-| 1 | 2<_<0 | nok, logically wrong |
-| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
-| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
--!|
-|test results for page|TestPage|should contain||
-*!
-
-!*> Tests for type double
-
-!| script |
-|given page|TestPage|with content|${SUT_PATH} !-
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-
-Test doubles by string comparison.
-In this case detailed diff ist wanted.
-
-| Detailed Diff |
-| actual double | expected double? | #comment |
-| 1.0 | 1.0 | equal |
-| 1.1 | 222 | completly different |
-| 1.0 | 10 | partially different |
-| | 1.0 | partially different |
-
-Test doubles by value comparison, see =1 | ok |
-| 1 | <2 | ok |
-| 1 | >1 | nok |
-| 1 | =1 | ok |
-| 1 | <1 | nok |
-| 1 | 0<_<2 | ok |
-| 1 | 2<_<0 | nok, logically wrong |
-| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
-| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
-| 1.0 | ~=1 | ok |
-| 1.1 | ~=1 | ok |
-| 0.9 | ~=1 | ok |
-| 1.0 | ~=1.0 | ok |
-| 1.1 | ~=1.0 | nok |
-| 0.9 | ~=1.0 | nok |
--!|
-|test results for page|TestPage|should contain||
-*!
-
-!*> Tests of fitnesse symbols
-
-!| script |
-|given page|TestPage|with content|${SUT_PATH} !-
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-Test symbols by string comparison.
-
-| Detailed Diff |
-| actual symbol | expected symbol? | #comment |
-| abc | $symbol= | |
-| $symbol | abc | |
-| $symbol | xyz | |
-| $symbol | xbc | |
-| $symbol | ayc | |
-| $symbol | abz | |
-| abc | $symbol | |
-| xyz | $symbol | |
-| xbc | $symbol | |
-| ayc | $symbol | |
-| abz | $symbol | |
-| | $symbol | |
--!|
-|test results for page|TestPage|should contain|!-abc-!|
-|test results for page|TestPage|should contain|!-[abc] expected [xyz]-!|
-|test results for page|TestPage|should contain|!-[abc] expected [xbc]-!|
-|test results for page|TestPage|should contain|!-[abc] expected [ayc]-!|
-|test results for page|TestPage|should contain|!-[abc] expected [abz]-!|
-|test results for page|TestPage|should contain|!-<span class="pass">$symbol->[abc]</span>-!|
-|test results for page|TestPage|should contain|!-[xyz] expected [$symbol->[abc]]-!|
-|test results for page|TestPage|should contain|!-[xbc] expected [$symbol->[abc]]-!|
-|test results for page|TestPage|should contain|!-[ayc] expected [$symbol->[abc]]-!|
-|test results for page|TestPage|should contain|!-[abz] expected [$symbol->[abc]]-!|
-|test results for page|TestPage|should contain|!-[] expected [$symbol->[abc]]-!|
-*!
-
-!*> Tests of custom comparator
-
-!| script |
-|given page|TestPage|with content|${SUT_PATH} !-
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-Test custom comparator, see FitNesse.UserGuide.AdministeringFitNesse.ConfigurationFile
-The inverse comparator fitnesse.slim.test.InverseComparator negates the method String.equals(String).
-
-| script | Detailed Diff |
-| note | everything not equals to 'abc' is ok |
-| check | echo | abc | inverse:xyz |
-| note | everything not equals to 'abc' is ok |
-| check | echo | abc | inverse:ABC |
-| note | everthing not equals to 'abc' is ok |
-| check | echo | abc | inverse:cba |
-| note | only 'abc' is nok |
-| check | echo | abc | inverse:abc |
--!|
-|test results for page|TestPage|should contain||
-*!
-
-!*> Tests of scenario
-
-!| script |
-|given page|TestPage|with content|${SUT_PATH} !-
-!define TEST_SYSTEM {slim}
-
-!| import |
-| fitnesse.slim.test |
-Test Scenario and Script
-
-!| Scenario | Detailed Diff Scenario Test |
-| start | Detailed Diff |
-| check | echo | hello | hello |
-| check | echo | hello | hallo |
-
-!| Script |
-| Detailed Diff Scenario Test |
--!|
-|test results for page|TestPage|should contain|!-hello-!|
-|test results for page|TestPage|should contain|!-[hello] expected [hallo]-!|
-*!
+!define TEST_SYSTEM {slim}
+
+!3 Diff of failed tests
+
+!4 Original intentionally failing tests
+
+The subordinate page >TestPage collects the following tests. The page is disabled because of many tests fails intentionally. It is useful for manual tests only.
+
+!4 Test wrapper for test
+
+!*> Tests for type string
+
+!| script |
+|given page|TestPage|with content|${SUT_PATH} !-
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+
+Test Strings by plain compare, neither custom compare nor regular expression.
+In this case detailed diff is wanted.
+
+| Detailed Diff |
+| actual string | expected string? | #comment |
+| abc | abc | equal |
+| abc | xyz | completly different |
+| abc | xbc | first char different |
+| abc | ayc | middle char different |
+| abc | abz | last char different |
+| | xyz | actual empty, expected filled |
+| abc | | actual filled, expected empty; will be counted as ignored |
+| <&> | <&> | equal with HTML special chars |
+| <&> | xyz | completly different with HTML special chars |
+| <&> | x&> | first char different with HTML special chars |
+| <&> | | middle char different with HTML special chars |
+| <&> | <&z | last char differentwith HTML special chars |
+| | <&> | actual empty, expected filled with HTML special chars |
+| abc | <&> | completly different with HTML special chars |
+| abc | | last char different with HTML special chars |
+| Hello World | Wellcome Lord | no obvious match |
+
+Test Strings by regular expression.
+In this case no detailed diff is wanted.
+
+| Detailed Diff |
+| actual string | expected string? | #comment |
+| abc | =~/abc/ | match |
+| abc | =~/a.c/ | match |
+| abc | =~/\w+/ | match |
+| abc | =~/\w{3}/ | match |
+| abc | =~/^\w{3}$/ | match |
+| abc | =~/\w{1}/ | match |
+| abc | =~/^\w{1}$/ | no match |
+| abc | =~/[ABC]+/ | no match |
+| abc | =~/[ABC]+/i | wrong syntax, disable value comparison, use string comparison |
+-!|
+|test results for page|TestPage|should contain|!-abc-!|
+|test results for page|TestPage|should contain|!-[abc] expected [xyz]-!|
+|test results for page|TestPage|should contain|!-[abc] expected [xbc]-!|
+|test results for page|TestPage|should contain|!-[abc] expected [ayc]-!|
+|test results for page|TestPage|should contain|!-[abc] expected [abz]-!|
+|test results for page|TestPage|should contain|!-[] expected [xyz]-!|
+|test results for page|TestPage|should contain|!-[Hello World] expected [Wellcome Lord]-!|
+*!
+
+!*> Tests for type int
+
+!| script |
+|given page|TestPage|with content|${SUT_PATH} !-
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+
+Test integers by string comparison.
+In this case detailed diff ist wanted.
+
+| Detailed Diff |
+| actual int | expected int? | #comment |
+| 1 | 1 | equal |
+| 1 | 2 | completly different |
+| 1 | 10 | partially different |
+| | 1 | completly different |
+
+Test integers by value comparison, see =1 | ok |
+| 1 | <2 | ok |
+| 1 | >1 | nok |
+| 1 | =1 | ok |
+| 1 | <1 | nok |
+| 1 | 0<_<2 | ok |
+| 1 | 2<_<0 | nok, logically wrong |
+| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
+| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
+-!|
+|test results for page|TestPage|should contain||
+*!
+
+!*> Tests for type double
+
+!| script |
+|given page|TestPage|with content|${SUT_PATH} !-
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+
+Test doubles by string comparison.
+In this case detailed diff ist wanted.
+
+| Detailed Diff |
+| actual double | expected double? | #comment |
+| 1.0 | 1.0 | equal |
+| 1.1 | 222 | completly different |
+| 1.0 | 10 | partially different |
+| | 1.0 | partially different |
+
+Test doubles by value comparison, see =1 | ok |
+| 1 | <2 | ok |
+| 1 | >1 | nok |
+| 1 | =1 | ok |
+| 1 | <1 | nok |
+| 1 | 0<_<2 | ok |
+| 1 | 2<_<0 | nok, logically wrong |
+| 1 | 0>_>2 | wrong syntax, disable value comparison, use string comparison |
+| 1 | 2>_>0 | wrong syntax, disable value comparison, use string comparison |
+| 1.0 | ~=1 | ok |
+| 1.1 | ~=1 | ok |
+| 0.9 | ~=1 | ok |
+| 1.0 | ~=1.0 | ok |
+| 1.1 | ~=1.0 | nok |
+| 0.9 | ~=1.0 | nok |
+-!|
+|test results for page|TestPage|should contain||
+*!
+
+!*> Tests of fitnesse symbols
+
+!| script |
+|given page|TestPage|with content|${SUT_PATH} !-
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+Test symbols by string comparison.
+
+| Detailed Diff |
+| actual symbol | expected symbol? | #comment |
+| abc | $symbol= | |
+| $symbol | abc | |
+| $symbol | xyz | |
+| $symbol | xbc | |
+| $symbol | ayc | |
+| $symbol | abz | |
+| abc | $symbol | |
+| xyz | $symbol | |
+| xbc | $symbol | |
+| ayc | $symbol | |
+| abz | $symbol | |
+| | $symbol | |
+-!|
+|test results for page|TestPage|should contain|!-abc-!|
+|test results for page|TestPage|should contain|!-[abc] expected [xyz]-!|
+|test results for page|TestPage|should contain|!-[abc] expected [xbc]-!|
+|test results for page|TestPage|should contain|!-[abc] expected [ayc]-!|
+|test results for page|TestPage|should contain|!-[abc] expected [abz]-!|
+|test results for page|TestPage|should contain|!-<span class="pass">$symbol->[abc]</span>-!|
+|test results for page|TestPage|should contain|!-[xyz] expected [$symbol->[abc]]-!|
+|test results for page|TestPage|should contain|!-[xbc] expected [$symbol->[abc]]-!|
+|test results for page|TestPage|should contain|!-[ayc] expected [$symbol->[abc]]-!|
+|test results for page|TestPage|should contain|!-[abz] expected [$symbol->[abc]]-!|
+|test results for page|TestPage|should contain|!-[] expected [$symbol->[abc]]-!|
+*!
+
+!*> Tests of custom comparator
+
+!| script |
+|given page|TestPage|with content|${SUT_PATH} !-
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+Test custom comparator, see FitNesse.UserGuide.AdministeringFitNesse.ConfigurationFile
+The inverse comparator fitnesse.slim.test.InverseComparator negates the method String.equals(String).
+
+| script | Detailed Diff |
+| note | everything not equals to 'abc' is ok |
+| check | echo | abc | inverse:xyz |
+| note | everything not equals to 'abc' is ok |
+| check | echo | abc | inverse:ABC |
+| note | everthing not equals to 'abc' is ok |
+| check | echo | abc | inverse:cba |
+| note | only 'abc' is nok |
+| check | echo | abc | inverse:abc |
+-!|
+|test results for page|TestPage|should contain||
+*!
+
+!*> Tests of scenario
+
+!| script |
+|given page|TestPage|with content|${SUT_PATH} !-
+!define TEST_SYSTEM {slim}
+
+!| import |
+| fitnesse.slim.test |
+Test Scenario and Script
+
+!| Scenario | Detailed Diff Scenario Test |
+| start | Detailed Diff |
+| check | echo | hello | hello |
+| check | echo | hello | hallo |
+
+!| Script |
+| Detailed Diff Scenario Test |
+-!|
+|test results for page|TestPage|should contain|!-hello-!|
+|test results for page|TestPage|should contain|!-[hello] expected [hallo]-!|
+*!
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/properties.xml
index 6ca0af3..55bd9cd 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestDetailedDiff/properties.xml
@@ -1,12 +1,12 @@
-
-
-true
-true
-true
-true
-true
-true
-true
-true
-true
-
+
+
+true
+true
+true
+true
+true
+true
+true
+true
+true
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/content.txt
index d666fa1..ed204d1 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/content.txt
@@ -1,33 +1,33 @@
-|import |
-|fitnesse.slim.test|
-
-
-There was a bug in the Scenario selection process that caused a scenario with no inputs to be selected when it should have been method on the driver class. This happened because the !-ScenarioTable-! class was enhanced to try all rows as parameterized. So it took "login" and tried "login _ ". This resulted in the "login" scenario being used instead of the "loginWithUsernameAndPassword" method when "connect as with" scenario was called. This page demonstrates the fix.
-
-
-!2 Scenario with no arguments and a shared root
-!|scenario |login |
-|connect to server|
-
-!2
-!|scenario |connect as|username |with|password|
-|login with username|@username |and Password|@password |
-
-
-!2 Scenario With one argument and a shared root.
-!|scenario |login with|name|
-|connect to server as|@name |
-
-
-!2 Now calling a scenario that does take arguments, but since it isn't in parameterized format, the scenario with an argument isn't called, even though it shares a common root.
-!|scenario |connect as|username |with|password|
-|login with username|@username |and Password|@password |
-
-
-
-
-!|script |
-|start |Login Dialog Driver|bob |xyzz|
-|connect as|bob |with|xyzz|
-
-
+|import |
+|fitnesse.slim.test|
+
+
+There was a bug in the Scenario selection process that caused a scenario with no inputs to be selected when it should have been method on the driver class. This happened because the !-ScenarioTable-! class was enhanced to try all rows as parameterized. So it took "login" and tried "login _ ". This resulted in the "login" scenario being used instead of the "loginWithUsernameAndPassword" method when "connect as with" scenario was called. This page demonstrates the fix.
+
+
+!2 Scenario with no arguments and a shared root
+!|scenario |login |
+|connect to server|
+
+!2
+!|scenario |connect as|username |with|password|
+|login with username|@username |and Password|@password |
+
+
+!2 Scenario With one argument and a shared root.
+!|scenario |login with|name|
+|connect to server as|@name |
+
+
+!2 Now calling a scenario that does take arguments, but since it isn't in parameterized format, the scenario with an argument isn't called, even though it shares a common root.
+!|scenario |connect as|username |with|password|
+|login with username|@username |and Password|@password |
+
+
+
+
+!|script |
+|start |Login Dialog Driver|bob |xyzz|
+|connect as|bob |with|xyzz|
+
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/properties.xml
index 4e908ad..e13fdf4 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/TestTryingParameterizationIsntTooGreedy/properties.xml
@@ -1,12 +1,12 @@
-
-
- true
- true
- true
- true
- true
- true
- true
- true
- true
-
+
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/content.txt
index 0c1ff96..86d613f 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/content.txt
@@ -1,14 +1,14 @@
-Create an absolute symbolic link from a sub-page:
-
-First we need to create some pages to play with.
-!|Page creator.|
-|Page name. |PageContents. |valid?|
-|LinkingPage |LINKING PAGE |true |
-|LinkingPage.LinkingChild|LINKING CHILD |true |
-|LinkedPage |LINKED PAGE |true |
-|LinkedPage.LinkedChild |LINKED CHILD |true |
-
-Now we create a symbolic link named !-SymLink-!. This links !-LinkedPage.LinkedChild-! as a child of !-LinkingPage.LinkingChild-!.
-!|Response Requester.|
-|uri |status?|
-|LinkingPage.LinkingChild?responder=symlink&linkName=SymLink&linkPath=.LinkedPage.LinkedChild|303|
+Create an absolute symbolic link from a sub-page:
+
+First we need to create some pages to play with.
+!|Page creator.|
+|Page name. |PageContents. |valid?|
+|LinkingPage |LINKING PAGE |true |
+|LinkingPage.LinkingChild|LINKING CHILD |true |
+|LinkedPage |LINKED PAGE |true |
+|LinkedPage.LinkedChild |LINKED CHILD |true |
+
+Now we create a symbolic link named !-SymLink-!. This links !-LinkedPage.LinkedChild-! as a child of !-LinkingPage.LinkingChild-!.
+!|Response Requester.|
+|uri |status?|
+|LinkingPage.LinkingChild?responder=symlink&linkName=SymLink&linkPath=.LinkedPage.LinkedChild|303|
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/properties.xml
index 321f386..40a15d7 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateAbsoluteSymbolicLink/properties.xml
@@ -1,10 +1,10 @@
-
-
-
-
- 20071209231745
-
-
- 1197255276583
- -2802271540647210678
-
+
+
+
+
+ 20071209231745
+
+
+ 1197255276583
+ -2802271540647210678
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateBackwardSymbolicLink/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateBackwardSymbolicLink/content.txt
index 236e215..46107f7 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateBackwardSymbolicLink/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateBackwardSymbolicLink/content.txt
@@ -1,13 +1,13 @@
-Create an absolute symbolic link from a sub-page:
-
-First we need to create some pages to play with.
-!|Page creator.|
-|Page name. |PageContents. |valid?|
-|LinkingPage |LINKING PAGE |true |
-|LinkingPage.LinkingChild|LINKING CHILD |true |
-|LinkingPage.LinkedChild |LINKED CHILD |true |
-
-Now we create a symbolic link named !-SymLink-!. This links !-LinkedPage.LinkedChild-! as a child of !-LinkingPage.LinkingChild-!.
-!|Response Requester.|
-|uri |status?|
-|LinkingPage.LinkingChild?responder=symlink&linkName=SymLink&linkPath=
-
-
-
- 20071209231818
-
-
- 1197255523311
- -2905294764201163185
-
+
+
+
+
+ 20071209231818
+
+
+ 1197255523311
+ -2905294764201163185
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateNestedBackSymbolicLink/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateNestedBackSymbolicLink/content.txt
index 0666d27..2c6e161 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateNestedBackSymbolicLink/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateNestedBackSymbolicLink/content.txt
@@ -1,15 +1,15 @@
-Create an nested backward symbolic link from a sub-page:
-
-First we need to create some pages to play with.
-!|Page creator.|
-|Page name. |PageContents. |valid?|
-|LinkingPage |LINKING PAGE |true |
-|LinkingPage.LinkingChild |LINKING CHILD |true |
-|LinkingPage.LinkingChild.LinkingGrandChild |LINKING GRAND CHILD |true |
-|LinkingPage.LinkingChild.LinkingGrandChild.LinkingGreatGrandChild|LINKING GREAT GRAND CHILD |true |
-|LinkingPage.LinkingChild.LinkedChild |LINKED CHILD |true |
-
-Now we create a symbolic link named !-SymLink-!. This links !-LinkedPage.LinkedChild-! as a child of !-LinkingPage.LinkingChild-!.
-!|Response Requester.|
-|uri |status?|
-|LinkingPage.LinkingChild.LinkingGrandChild.LinkingGreatGrandChild?responder=symlink&linkName=SymLink&linkPath=
-
-
-
- 20071212153458
-
-
- 1197318232254
- -6614712250920689672
-
+
+
+
+
+ 20071212153458
+
+
+ 1197318232254
+ -6614712250920689672
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/content.txt
index 78d3ef3..0db90fc 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/content.txt
@@ -1,15 +1,15 @@
-Creating a symbolic link is done in the properties view of the page that will contain the link. There is a form where a user supplies a name for the link and a path for the linked page. When submitted the URL has the following form:
-
-!-http://host/PathToPage?responder=symlink&linkName=&linkPath=-!
-
-First we need to create some pages to play with.
-!|Page creator.|
-|Page name.|valid?|
-|LinkingPage|true|
-|LinkedPage|true|
-
-Now we create a symbolic link named !-SymLink-!. This links !-LinkedPage-! as a child of !-LinkingPage-!.
-!|Response Requester.|
-|uri |status?|
-|LinkingPage?responder=symlink&linkName=SymLink&linkPath=LinkedPage|303|
-
+Creating a symbolic link is done in the properties view of the page that will contain the link. There is a form where a user supplies a name for the link and a path for the linked page. When submitted the URL has the following form:
+
+!-http://host/PathToPage?responder=symlink&linkName=&linkPath=-!
+
+First we need to create some pages to play with.
+!|Page creator.|
+|Page name.|valid?|
+|LinkingPage|true|
+|LinkedPage|true|
+
+Now we create a symbolic link named !-SymLink-!. This links !-LinkedPage-! as a child of !-LinkingPage-!.
+!|Response Requester.|
+|uri |status?|
+|LinkingPage?responder=symlink&linkName=SymLink&linkPath=LinkedPage|303|
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/properties.xml
index cccf3d6..397f67b 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateRelativeSymbolicLink/properties.xml
@@ -1,10 +1,10 @@
-
-
-
-
- 20071209231838
-
-
- 1197229524174
- 5360217332855886973
-
+
+
+
+
+ 20071209231838
+
+
+ 1197229524174
+ 5360217332855886973
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/content.txt
index 1dff5c4..7518a79 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/content.txt
@@ -1,12 +1,12 @@
-Create a symbolic link to a sub-page:
-
-First we need to create some pages to play with.
-!|Page creator.|
-|Page name. |PageContents. |valid?|
-|LinkingPage |LINKING PAGE |true |
-|LinkingPage.LinkedChild |LINKED CHILD |true |
-
-Now we create a symbolic link named !-SymLink-!. This links !-LinkingPage.LinkedChild-! as a child of !-LinkingPage-!.
-!|Response Requester.|
-|uri |status?|
-|LinkingPage?responder=symlink&linkName=SymLink&linkPath=>LinkedChild|303|
+Create a symbolic link to a sub-page:
+
+First we need to create some pages to play with.
+!|Page creator.|
+|Page name. |PageContents. |valid?|
+|LinkingPage |LINKING PAGE |true |
+|LinkingPage.LinkedChild |LINKED CHILD |true |
+
+Now we create a symbolic link named !-SymLink-!. This links !-LinkingPage.LinkedChild-! as a child of !-LinkingPage-!.
+!|Response Requester.|
+|uri |status?|
+|LinkingPage?responder=symlink&linkName=SymLink&linkPath=>LinkedChild|303|
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/properties.xml
index 54faed6..c67bf59 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/CreateSubPageSymbolicLink/properties.xml
@@ -1,14 +1,14 @@
-
-
- true
- true
- 20071209210332
- true
- true
- true
- true
- true
- true
- 1197252212825
- 6202123951021509855
-
+
+
+ true
+ true
+ 20071209210332
+ true
+ true
+ true
+ true
+ true
+ true
+ 1197252212825
+ 6202123951021509855
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/content.txt b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/content.txt
index 0f89b13..759f058 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/content.txt
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/content.txt
@@ -1,14 +1,14 @@
-!c !3 Symbolic Links
-
-Symbolic Links allow a user to easily create parent-child links between pages without permanently affecting the wiki structure. One common reason need for Symbolic Links is the the testing of a system on multiple environments. For example, imagine an application that site on top of an Oracle database. Hundreds of FitNesse tests have been written for this application using Oracle settings and then the team is confronted with the need to run the application on !-MySql-!. Getting both databases running under the same suite of tests can be very difficult and may result in duplicating all the tests. With Symbolic Links, the database configurations can be stored in high level pages along with appropriate path elements. Then the high-level pages may symbolically link to the test suite. In this manner one suite of tests can be executed in multiple environments.
-
-
->TestCreatingRelativeSymbolicLink
->TestCreatingAbsoluteSymbolicLink
->TestCreatingSubPageSymbolicLink
->TestCreatingBackwardSymbolicLink
->TestRemovingSymbolicLink
->TestSymbolicLinkBehavior
-----
-All Subpages:
+!c !3 Symbolic Links
+
+Symbolic Links allow a user to easily create parent-child links between pages without permanently affecting the wiki structure. One common reason need for Symbolic Links is the the testing of a system on multiple environments. For example, imagine an application that site on top of an Oracle database. Hundreds of FitNesse tests have been written for this application using Oracle settings and then the team is confronted with the need to run the application on !-MySql-!. Getting both databases running under the same suite of tests can be very difficult and may result in duplicating all the tests. With Symbolic Links, the database configurations can be stored in high level pages along with appropriate path elements. Then the high-level pages may symbolically link to the test suite. In this manner one suite of tests can be executed in multiple environments.
+
+
+>TestCreatingRelativeSymbolicLink
+>TestCreatingAbsoluteSymbolicLink
+>TestCreatingSubPageSymbolicLink
+>TestCreatingBackwardSymbolicLink
+>TestRemovingSymbolicLink
+>TestSymbolicLinkBehavior
+----
+All Subpages:
!contents
\ No newline at end of file
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/properties.xml
index 3b4d24d..3c2058d 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSymbolicLinkTests/properties.xml
@@ -1,12 +1,12 @@
-
-
-
-
- 20071209232537
-
-
-
-
- 1197260737340
- 159061011507139978
-
+
+
+
+
+ 20071209232537
+
+
+
+
+ 1197260737340
+ 159061011507139978
+
diff --git a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestHttpStatus/properties.xml b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestHttpStatus/properties.xml
index abb3da8..59a0a7c 100644
--- a/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestHttpStatus/properties.xml
+++ b/fitnesse/FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteWidgetTests/TestHttpStatus/properties.xml
@@ -1,9 +1,9 @@
-
-
-
- 20071130010014
-
-
-
-
-
+
+
+
+ 20071130010014
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index bebc9c3..dbab89a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,6 @@
-
+
4.0.0
@@ -9,24 +8,17 @@
transcendental-lisp
1.2.0
+
+ UTF-8
+ 1.2.30
+ 5.1.0
+ false
+
+
- src
- test
-
-
-
- lisp/lang
-
-
-
-
-
- test
-
- **/*.java
-
-
-
+
+
+
@@ -41,10 +33,62 @@
3.0.2
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+ ${kotlin.version}
+
+
+ compile
+ compile
+
+ compile
+
+
+
+ test-compile
+ test-compile
+
+ test-compile
+
+
+
+
+ 1.8
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
3.7.0
+
+
+
+ default-compile
+ none
+
+
+
+ default-testCompile
+ none
+
+
+ java-compile
+ compile
+
+ compile
+
+
+
+ java-test-compile
+ test-compile
+
+ testCompile
+
+
+
1.8
@@ -54,7 +98,29 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.20.1
+ 2.19.1
+
+
+ org.junit.platform
+ junit-platform-surefire-provider
+ 1.0.1
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit5.version}
+
+
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ ${junit5.version}
+
+
+
+ ${skipTests}
+
@@ -84,7 +150,7 @@
- main.LispMain
+ application.LispMain
@@ -95,12 +161,40 @@
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk8
+ ${kotlin.version}
+
+
com.googlecode.lanterna
lanterna
3.0.0
+
+ org.assertj
+ assertj-core
+ 3.9.1
+ test
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit5.version}
+ test
+
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ ${junit5.version}
+ test
+
+
+
junit
junit
@@ -108,6 +202,7 @@
test
+
org.hamcrest
hamcrest-all
@@ -130,8 +225,4 @@
-
- UTF-8
-
-
\ No newline at end of file
diff --git a/src/error/CriticalLineColumnException.java b/src/error/CriticalLineColumnException.java
deleted file mode 100644
index a8c2cc5..0000000
--- a/src/error/CriticalLineColumnException.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package error;
-
-import static error.ErrorManager.Severity.CRITICAL;
-
-import error.ErrorManager.Severity;
-import file.FilePosition;
-
-public abstract class CriticalLineColumnException extends LineColumnException {
-
- private static final long serialVersionUID = 1L;
-
- public CriticalLineColumnException(FilePosition position) {
- super(position);
- }
-
- @Override
- public Severity getSeverity() {
- return CRITICAL;
- }
-
-}
\ No newline at end of file
diff --git a/src/error/CriticalLispException.java b/src/error/CriticalLispException.java
deleted file mode 100644
index b0bb04b..0000000
--- a/src/error/CriticalLispException.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package error;
-
-import static error.ErrorManager.Severity.CRITICAL;
-
-import error.ErrorManager.Severity;
-
-public abstract class CriticalLispException extends LispException {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Severity getSeverity() {
- return CRITICAL;
- }
-
-}
diff --git a/src/error/ErrorManager.java b/src/error/ErrorManager.java
deleted file mode 100644
index f4f49ff..0000000
--- a/src/error/ErrorManager.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package error;
-
-import static error.ErrorManager.Severity.CRITICAL;
-import static error.ErrorManager.Severity.WARNING;
-import static java.text.MessageFormat.format;
-
-import java.io.PrintStream;
-
-import environment.RuntimeEnvironment;
-
-/**
- * Prints error messages and potentially terminates the application.
- */
-public class ErrorManager {
-
- private RuntimeEnvironment environment;
-
- public ErrorManager() {
- this.environment = RuntimeEnvironment.getInstance();
- }
-
- public void handle(LispException lispException) {
- printMessage(lispException);
-
- if (isCritical(lispException))
- environment.terminateExceptionally();
- }
-
- private void printMessage(LispException lispException) {
- PrintStream output = selectOutputStream(lispException.getSeverity());
- output.println(formatMessage(lispException));
- }
-
- private PrintStream selectOutputStream(Severity severity) {
- if (severity == WARNING)
- return environment.getOutput();
-
- return environment.getErrorOutput();
- }
-
- private String formatMessage(LispException lispException) {
- Severity severity = lispException.getSeverity();
- String prefix = severity.toDisplayString();
- String message = format("[{0}] {1}", prefix, lispException.getMessage());
-
- return severity.decorate(message, environment);
- }
-
- private boolean isCritical(LispException lispException) {
- return lispException.getSeverity() == CRITICAL;
- }
-
- public static enum Severity {
-
- WARNING {
-
- @Override
- public String decorate(String warningOutput, RuntimeEnvironment environment) {
- return environment.decorateWarningOutput(warningOutput);
- }
-
- @Override
- public String toDisplayString() {
- return "warning";
- }
- },
-
- ERROR {
-
- @Override
- public String decorate(String errorOutput, RuntimeEnvironment environment) {
- return environment.decorateErrorOutput(errorOutput);
- }
-
- @Override
- public String toDisplayString() {
- return "error";
- }
- },
-
- CRITICAL {
-
- @Override
- public String decorate(String criticalOutput, RuntimeEnvironment environment) {
- return environment.decorateCriticalOutput(criticalOutput);
- }
-
- @Override
- public String toDisplayString() {
- return "critical";
- }
- };
-
- public abstract String decorate(String output, RuntimeEnvironment environment);
-
- public abstract String toDisplayString();
- }
-
-}
diff --git a/src/error/LineColumnException.java b/src/error/LineColumnException.java
deleted file mode 100644
index 6da696a..0000000
--- a/src/error/LineColumnException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package error;
-
-import static java.text.MessageFormat.format;
-
-import file.FilePosition;
-
-public abstract class LineColumnException extends LispException {
-
- private static final long serialVersionUID = 1L;
- private FilePosition position;
-
- public LineColumnException(FilePosition position) {
- this.position = position;
- }
-
- @Override
- public String getMessage() {
- return format("{0} - line {1}, column {2}",
- getMessagePrefix(),
- position.getLineNumber(),
- position.getColumnNumber());
- }
-
- public abstract String getMessagePrefix();
-
-}
\ No newline at end of file
diff --git a/src/error/LispException.java b/src/error/LispException.java
deleted file mode 100644
index 32eb330..0000000
--- a/src/error/LispException.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package error;
-
-import static error.ErrorManager.Severity.ERROR;
-
-import error.ErrorManager.Severity;
-
-public abstract class LispException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public Severity getSeverity() {
- return ERROR;
- }
-
-}
diff --git a/src/error/LispWarning.java b/src/error/LispWarning.java
deleted file mode 100644
index a6351dc..0000000
--- a/src/error/LispWarning.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package error;
-
-import static error.ErrorManager.Severity.WARNING;
-
-import error.ErrorManager.Severity;
-
-public abstract class LispWarning extends LispException {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public Severity getSeverity() {
- return WARNING;
- }
-
-}
diff --git a/src/function/builtin/special/LAMBDA.java b/src/function/builtin/special/LAMBDA.java
deleted file mode 100644
index b33eb5c..0000000
--- a/src/function/builtin/special/LAMBDA.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package function.builtin.special;
-
-import static function.builtin.cons.LIST.makeList;
-
-import function.ArgumentValidator;
-import function.FunctionNames;
-import function.LispSpecialFunction;
-import function.UserDefinedFunction;
-import sexpression.Cons;
-import sexpression.LambdaExpression;
-import sexpression.SExpression;
-import sexpression.Symbol;
-
-@FunctionNames({ "LAMBDA", "Λ" })
-public class LAMBDA extends LispSpecialFunction {
-
- public static boolean isLambdaExpression(SExpression sexpr) {
- if (sexpr.isCons()) {
- String first = ((Cons) sexpr).getFirst().toString();
-
- return "LAMBDA".equals(first) || "Λ".equals(first);
- }
-
- return false;
- }
-
- public static UserDefinedFunction createFunction(Cons lambdaExpression) {
- SExpression rest = lambdaExpression.getRest();
-
- ArgumentValidator lambdaValidator = new ArgumentValidator("LAMBDA|create|");
- lambdaValidator.setEveryArgumentExpectedType(Cons.class);
- lambdaValidator.validate(makeList(rest));
-
- LambdaExpression lambda = new LAMBDA("LAMBDA").call((Cons) rest);
-
- return lambda.getFunction();
- }
-
- private ArgumentValidator argumentValidator;
- private ArgumentValidator lambdaListValidator;
-
- public LAMBDA(String name) {
- this.argumentValidator = new ArgumentValidator(name);
- this.argumentValidator.setFirstArgumentExpectedType(Cons.class);
- this.argumentValidator.setMinimumNumberOfArguments(1);
-
- this.lambdaListValidator = new ArgumentValidator(name + "|lambda-list|");
- this.lambdaListValidator.setEveryArgumentExpectedType(Symbol.class);
- }
-
- @Override
- public LambdaExpression call(Cons argumentList) {
- argumentValidator.validate(argumentList);
-
- SExpression first = argumentList.getFirst();
- Cons lambdaList = (Cons) first;
- Cons body = (Cons) argumentList.getRest();
-
- lambdaListValidator.validate(lambdaList);
-
- UserDefinedFunction function = new UserDefinedFunction(":LAMBDA", lambdaList, body);
-
- return new LambdaExpression(makeOriginalLambdaExpression(argumentList), function);
- }
-
- private Cons makeOriginalLambdaExpression(Cons argumentList) {
- return new Cons(new Symbol("LAMBDA"), argumentList);
- }
-
-}
diff --git a/src/main/LispMain.java b/src/main/java/application/LispMain.java
similarity index 99%
rename from src/main/LispMain.java
rename to src/main/java/application/LispMain.java
index 837af64..119f88d 100644
--- a/src/main/LispMain.java
+++ b/src/main/java/application/LispMain.java
@@ -1,8 +1,14 @@
-package main;
+package application;
-import static com.googlecode.lanterna.terminal.IOSafeTerminalAdapter.createRuntimeExceptionConvertingAdapter;
-import static java.text.MessageFormat.format;
-import static terminal.LispTerminal.END_OF_SEGMENT;
+import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
+import com.googlecode.lanterna.terminal.IOSafeTerminal;
+import com.googlecode.lanterna.terminal.Terminal;
+import interpreter.LispInterpreter;
+import interpreter.LispInterpreterBuilder;
+import interpreter.LispInterpreterBuilderImpl;
+import stream.UncheckedIOException;
+import terminal.LispTerminal;
+import terminal.TerminalConfiguration;
import java.io.IOException;
import java.io.PipedInputStream;
@@ -10,16 +16,9 @@ import java.io.PipedOutputStream;
import java.io.PrintStream;
import java.util.function.Function;
-import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
-import com.googlecode.lanterna.terminal.IOSafeTerminal;
-import com.googlecode.lanterna.terminal.Terminal;
-
-import interpreter.LispInterpreter;
-import interpreter.LispInterpreterBuilder;
-import interpreter.LispInterpreterBuilderImpl;
-import stream.UncheckedIOException;
-import terminal.LispTerminal;
-import terminal.TerminalConfiguration;
+import static com.googlecode.lanterna.terminal.IOSafeTerminalAdapter.createRuntimeExceptionConvertingAdapter;
+import static java.text.MessageFormat.format;
+import static terminal.LispTerminal.END_OF_SEGMENT;
public class LispMain {
@@ -152,5 +151,4 @@ public class LispMain {
return builder.build();
}
-
}
diff --git a/src/environment/RuntimeEnvironment.java b/src/main/java/environment/RuntimeEnvironment.java
similarity index 99%
rename from src/environment/RuntimeEnvironment.java
rename to src/main/java/environment/RuntimeEnvironment.java
index a0d993e..a728b64 100644
--- a/src/environment/RuntimeEnvironment.java
+++ b/src/main/java/environment/RuntimeEnvironment.java
@@ -1,11 +1,11 @@
package environment;
+import error.ErrorManager;
+
import java.io.InputStream;
import java.io.PrintStream;
import java.util.function.Function;
-import error.ErrorManager;
-
public class RuntimeEnvironment {
private static RuntimeEnvironment uniqueInstance = new RuntimeEnvironment();
@@ -151,5 +151,4 @@ public class RuntimeEnvironment {
public String decorateCriticalOutput(String criticalOutput) {
return criticalOutputDecorator.apply(criticalOutput);
}
-
}
diff --git a/src/main/java/error/CriticalLineColumnException.kt b/src/main/java/error/CriticalLineColumnException.kt
new file mode 100644
index 0000000..5ef408c
--- /dev/null
+++ b/src/main/java/error/CriticalLineColumnException.kt
@@ -0,0 +1,9 @@
+package error
+
+import error.Severity.CRITICAL
+import file.FilePosition
+
+abstract class CriticalLineColumnException(position: FilePosition) : LineColumnException(position) {
+
+ override val severity = CRITICAL
+}
\ No newline at end of file
diff --git a/src/main/java/error/CriticalLispException.kt b/src/main/java/error/CriticalLispException.kt
new file mode 100644
index 0000000..69e9a6c
--- /dev/null
+++ b/src/main/java/error/CriticalLispException.kt
@@ -0,0 +1,8 @@
+package error
+
+import error.Severity.CRITICAL
+
+abstract class CriticalLispException : LispException() {
+
+ override val severity = CRITICAL
+}
diff --git a/src/main/java/error/ErrorManager.kt b/src/main/java/error/ErrorManager.kt
new file mode 100644
index 0000000..ea4f1b1
--- /dev/null
+++ b/src/main/java/error/ErrorManager.kt
@@ -0,0 +1,41 @@
+package error
+
+import environment.RuntimeEnvironment
+import error.Severity.CRITICAL
+import error.Severity.WARNING
+import java.io.PrintStream
+import java.text.MessageFormat.format
+
+/**
+ * Prints error messages and potentially terminates the application.
+ */
+class ErrorManager {
+
+ private val environment: RuntimeEnvironment = RuntimeEnvironment.getInstance()
+
+ fun handle(lispException: LispException) {
+ printMessage(lispException)
+
+ if (isCritical(lispException))
+ environment.terminateExceptionally()
+ }
+
+ private fun printMessage(lispException: LispException) {
+ val output = selectOutputStream(lispException.severity)
+ output.println(formatMessage(lispException))
+ }
+
+ private fun selectOutputStream(severity: Severity): PrintStream {
+ return if (severity === WARNING) environment.output else environment.errorOutput
+ }
+
+ private fun formatMessage(lispException: LispException): String {
+ val severity = lispException.severity
+ val prefix = severity.toDisplayString()
+ val message = format("[{0}] {1}", prefix, lispException.message)
+
+ return severity.decorate(message, environment)
+ }
+
+ private fun isCritical(lispException: LispException) = lispException.severity == CRITICAL
+}
diff --git a/src/main/java/error/LineColumnException.kt b/src/main/java/error/LineColumnException.kt
new file mode 100644
index 0000000..f2eb7e0
--- /dev/null
+++ b/src/main/java/error/LineColumnException.kt
@@ -0,0 +1,12 @@
+package error
+
+import file.FilePosition
+import java.text.MessageFormat.format
+
+abstract class LineColumnException(private val position: FilePosition) : LispException() {
+
+ abstract val messagePrefix: String
+
+ override val message: String
+ get() = format("{0} - line {1}, column {2}", messagePrefix, position.lineNumber, position.columnNumber)
+}
\ No newline at end of file
diff --git a/src/main/java/error/LispException.kt b/src/main/java/error/LispException.kt
new file mode 100644
index 0000000..b5a6dec
--- /dev/null
+++ b/src/main/java/error/LispException.kt
@@ -0,0 +1,8 @@
+package error
+
+import error.Severity.ERROR
+
+abstract class LispException : RuntimeException() {
+
+ open val severity = ERROR
+}
diff --git a/src/main/java/error/LispWarning.kt b/src/main/java/error/LispWarning.kt
new file mode 100644
index 0000000..37abb6f
--- /dev/null
+++ b/src/main/java/error/LispWarning.kt
@@ -0,0 +1,8 @@
+package error
+
+import error.Severity.WARNING
+
+abstract class LispWarning : LispException() {
+
+ override val severity = WARNING
+}
diff --git a/src/main/java/error/Severity.kt b/src/main/java/error/Severity.kt
new file mode 100644
index 0000000..3fd2cce
--- /dev/null
+++ b/src/main/java/error/Severity.kt
@@ -0,0 +1,31 @@
+package error
+
+import environment.RuntimeEnvironment
+
+enum class Severity {
+
+ WARNING {
+ override fun decorate(output: String, environment: RuntimeEnvironment): String =
+ environment.decorateWarningOutput(output)
+
+ override fun toDisplayString() = "warning"
+ },
+
+ ERROR {
+ override fun decorate(output: String, environment: RuntimeEnvironment): String =
+ environment.decorateErrorOutput(output)
+
+ override fun toDisplayString() = "error"
+ },
+
+ CRITICAL {
+ override fun decorate(output: String, environment: RuntimeEnvironment): String =
+ environment.decorateCriticalOutput(output)
+
+ override fun toDisplayString() = "critical"
+ };
+
+ abstract fun decorate(output: String, environment: RuntimeEnvironment): String
+
+ abstract fun toDisplayString(): String
+}
\ No newline at end of file
diff --git a/src/file/FilePosition.java b/src/main/java/file/FilePosition.java
similarity index 99%
rename from src/file/FilePosition.java
rename to src/main/java/file/FilePosition.java
index e65837b..83cf0e1 100644
--- a/src/file/FilePosition.java
+++ b/src/main/java/file/FilePosition.java
@@ -29,5 +29,4 @@ public class FilePosition {
public void setColumnNumber(int columnNumber) {
this.columnNumber = columnNumber;
}
-
}
\ No newline at end of file
diff --git a/src/file/FilePositionTracker.java b/src/main/java/file/FilePositionTracker.java
similarity index 99%
rename from src/file/FilePositionTracker.java
rename to src/main/java/file/FilePositionTracker.java
index 6b8074b..bf6c33e 100644
--- a/src/file/FilePositionTracker.java
+++ b/src/main/java/file/FilePositionTracker.java
@@ -28,5 +28,4 @@ public class FilePositionTracker {
lineNumber++;
columnNumber = 0;
}
-
}
\ No newline at end of file
diff --git a/src/function/ArgumentValidator.java b/src/main/java/function/ArgumentValidator.java
similarity index 99%
rename from src/function/ArgumentValidator.java
rename to src/main/java/function/ArgumentValidator.java
index 9752f8b..dc0db05 100644
--- a/src/function/ArgumentValidator.java
+++ b/src/main/java/function/ArgumentValidator.java
@@ -1,15 +1,15 @@
package function;
-import static function.builtin.cons.LENGTH.getLength;
-import static java.text.MessageFormat.format;
-
-import java.math.BigInteger;
-
import error.LispException;
import sexpression.Cons;
import sexpression.DisplayName;
import sexpression.SExpression;
+import java.math.BigInteger;
+
+import static function.builtin.cons.LENGTH.getLength;
+import static java.text.MessageFormat.format;
+
public class ArgumentValidator {
private Class extends SExpression> firstArgumentType;
@@ -231,5 +231,4 @@ public class ArgumentValidator {
return (displayName == null) ? "unknown" : displayName.value();
}
}
-
}
diff --git a/src/function/FunctionNames.java b/src/main/java/function/FunctionNames.java
similarity index 99%
rename from src/function/FunctionNames.java
rename to src/main/java/function/FunctionNames.java
index 45e173c..5e8005b 100644
--- a/src/function/FunctionNames.java
+++ b/src/main/java/function/FunctionNames.java
@@ -10,5 +10,4 @@ import java.lang.annotation.Target;
public @interface FunctionNames {
String[] value();
-
}
diff --git a/src/function/LispFunction.java b/src/main/java/function/LispFunction.java
similarity index 99%
rename from src/function/LispFunction.java
rename to src/main/java/function/LispFunction.java
index 6b6704e..bd2c48b 100644
--- a/src/function/LispFunction.java
+++ b/src/main/java/function/LispFunction.java
@@ -14,5 +14,4 @@ public abstract class LispFunction {
public boolean isMacro() {
return false;
}
-
}
diff --git a/src/function/LispSpecialFunction.java b/src/main/java/function/LispSpecialFunction.java
similarity index 99%
rename from src/function/LispSpecialFunction.java
rename to src/main/java/function/LispSpecialFunction.java
index c99941a..3b8953d 100644
--- a/src/function/LispSpecialFunction.java
+++ b/src/main/java/function/LispSpecialFunction.java
@@ -6,5 +6,4 @@ public abstract class LispSpecialFunction extends LispFunction {
public boolean isArgumentListEvaluated() {
return false;
}
-
}
diff --git a/src/function/UserDefinedFunction.java b/src/main/java/function/UserDefinedFunction.java
similarity index 99%
rename from src/function/UserDefinedFunction.java
rename to src/main/java/function/UserDefinedFunction.java
index 019fddb..6ed4569 100644
--- a/src/function/UserDefinedFunction.java
+++ b/src/main/java/function/UserDefinedFunction.java
@@ -1,12 +1,5 @@
package function;
-import static function.builtin.EVAL.eval;
-import static java.text.MessageFormat.format;
-import static recursion.TailCalls.done;
-import static sexpression.Nil.NIL;
-
-import java.util.ArrayList;
-
import error.LispException;
import recursion.TailCall;
import recursion.TailCalls;
@@ -16,6 +9,13 @@ import sexpression.Symbol;
import table.ExecutionContext;
import table.SymbolTable;
+import java.util.ArrayList;
+
+import static function.builtin.EVAL.eval;
+import static java.text.MessageFormat.format;
+import static recursion.TailCalls.done;
+import static sexpression.Nil.NIL;
+
public class UserDefinedFunction extends LispFunction {
private static final String KEYWORD_REST = "&REST";
@@ -166,5 +166,4 @@ public class UserDefinedFunction extends LispFunction {
parameters);
}
}
-
}
diff --git a/src/function/UserDefinedMacro.java b/src/main/java/function/UserDefinedMacro.java
similarity index 99%
rename from src/function/UserDefinedMacro.java
rename to src/main/java/function/UserDefinedMacro.java
index b59b67d..02f0baf 100644
--- a/src/function/UserDefinedMacro.java
+++ b/src/main/java/function/UserDefinedMacro.java
@@ -12,5 +12,4 @@ public class UserDefinedMacro extends UserDefinedSpecialFunction {
public boolean isMacro() {
return true;
}
-
}
diff --git a/src/function/UserDefinedSpecialFunction.java b/src/main/java/function/UserDefinedSpecialFunction.java
similarity index 99%
rename from src/function/UserDefinedSpecialFunction.java
rename to src/main/java/function/UserDefinedSpecialFunction.java
index 4ce4010..848c398 100644
--- a/src/function/UserDefinedSpecialFunction.java
+++ b/src/main/java/function/UserDefinedSpecialFunction.java
@@ -12,5 +12,4 @@ public class UserDefinedSpecialFunction extends UserDefinedFunction {
public boolean isArgumentListEvaluated() {
return false;
}
-
}
diff --git a/src/function/builtin/APPLY.java b/src/main/java/function/builtin/APPLY.java
similarity index 99%
rename from src/function/builtin/APPLY.java
rename to src/main/java/function/builtin/APPLY.java
index 3fd6002..6637542 100644
--- a/src/function/builtin/APPLY.java
+++ b/src/main/java/function/builtin/APPLY.java
@@ -1,15 +1,15 @@
package function.builtin;
-import static function.builtin.EVAL.applyFunction;
-import static function.builtin.EVAL.lookupFunctionOrLambda;
-import static table.FunctionTable.lookupFunction;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.EVAL.applyFunction;
+import static function.builtin.EVAL.lookupFunctionOrLambda;
+import static table.FunctionTable.lookupFunction;
+
@FunctionNames({ "APPLY" })
public class APPLY extends LispFunction {
@@ -36,5 +36,4 @@ public class APPLY extends LispFunction {
return applyFunction(function, functionArguments);
}
-
}
diff --git a/src/function/builtin/BackquoteEvaluator.java b/src/main/java/function/builtin/BackquoteEvaluator.java
similarity index 99%
rename from src/function/builtin/BackquoteEvaluator.java
rename to src/main/java/function/builtin/BackquoteEvaluator.java
index 4ea1eba..462640b 100644
--- a/src/function/builtin/BackquoteEvaluator.java
+++ b/src/main/java/function/builtin/BackquoteEvaluator.java
@@ -1,8 +1,5 @@
package function.builtin;
-import static function.builtin.EVAL.eval;
-import static sexpression.Nil.NIL;
-
import error.LispException;
import function.ArgumentValidator;
import sexpression.AtSignExpression;
@@ -11,6 +8,9 @@ import sexpression.CommaExpression;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+import static sexpression.Nil.NIL;
+
class BackquoteEvaluator {
private ArgumentValidator listValidator;
@@ -201,5 +201,4 @@ class BackquoteEvaluator {
return "at sign did not evaluate to a list";
}
}
-
}
diff --git a/src/function/builtin/EVAL.java b/src/main/java/function/builtin/EVAL.java
similarity index 96%
rename from src/function/builtin/EVAL.java
rename to src/main/java/function/builtin/EVAL.java
index d351753..0a2d576 100644
--- a/src/function/builtin/EVAL.java
+++ b/src/main/java/function/builtin/EVAL.java
@@ -1,17 +1,10 @@
package function.builtin;
-import static function.builtin.cons.LIST.makeList;
-import static function.builtin.special.LAMBDA.createFunction;
-import static function.builtin.special.LAMBDA.isLambdaExpression;
-import static java.text.MessageFormat.format;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-import static table.FunctionTable.lookupFunction;
-
import error.LispException;
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
+import function.builtin.special.LAMBDA;
import function.builtin.special.RECUR.RecurNotInTailPositionException;
import sexpression.BackquoteExpression;
import sexpression.Cons;
@@ -20,6 +13,12 @@ import sexpression.SExpression;
import sexpression.Symbol;
import table.ExecutionContext;
+import static function.builtin.cons.LIST.makeList;
+import static java.text.MessageFormat.format;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+import static table.FunctionTable.lookupFunction;
+
@FunctionNames({ "EVAL" })
public class EVAL extends LispFunction {
@@ -60,8 +59,8 @@ public class EVAL extends LispFunction {
private static LispFunction createLambdaFunction(SExpression lambdaExpression) {
if (lambdaExpression.isFunction())
return ((LambdaExpression) lambdaExpression).getFunction();
- else if (isLambdaExpression(lambdaExpression))
- return createFunction((Cons) lambdaExpression);
+ else if (LAMBDA.Companion.isLambdaExpression(lambdaExpression))
+ return LAMBDA.Companion.createFunction((Cons) lambdaExpression);
else
throw new UndefinedFunctionException(lambdaExpression);
}
@@ -228,5 +227,4 @@ public class EVAL extends LispFunction {
return "unmatched at sign";
}
}
-
}
diff --git a/src/function/builtin/EXIT.java b/src/main/java/function/builtin/EXIT.java
similarity index 99%
rename from src/function/builtin/EXIT.java
rename to src/main/java/function/builtin/EXIT.java
index a46be6c..5b91760 100644
--- a/src/function/builtin/EXIT.java
+++ b/src/main/java/function/builtin/EXIT.java
@@ -1,7 +1,5 @@
package function.builtin;
-import static sexpression.Nil.NIL;
-
import environment.RuntimeEnvironment;
import function.ArgumentValidator;
import function.FunctionNames;
@@ -9,6 +7,8 @@ import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+
@FunctionNames({ "EXIT" })
public class EXIT extends LispFunction {
@@ -28,5 +28,4 @@ public class EXIT extends LispFunction {
return NIL;
}
-
}
diff --git a/src/function/builtin/FUNCALL.java b/src/main/java/function/builtin/FUNCALL.java
similarity index 99%
rename from src/function/builtin/FUNCALL.java
rename to src/main/java/function/builtin/FUNCALL.java
index 9db896f..c21194a 100644
--- a/src/function/builtin/FUNCALL.java
+++ b/src/main/java/function/builtin/FUNCALL.java
@@ -1,14 +1,14 @@
package function.builtin;
-import static function.builtin.APPLY.apply;
-import static function.builtin.cons.LIST.makeList;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.APPLY.apply;
+import static function.builtin.cons.LIST.makeList;
+
@FunctionNames({ "FUNCALL", "CALL" })
public class FUNCALL extends LispFunction {
@@ -26,5 +26,4 @@ public class FUNCALL extends LispFunction {
return apply(applyArgs);
}
-
}
diff --git a/src/function/builtin/FUSE.java b/src/main/java/function/builtin/FUSE.java
similarity index 99%
rename from src/function/builtin/FUSE.java
rename to src/main/java/function/builtin/FUSE.java
index 30731c2..c662551 100644
--- a/src/function/builtin/FUSE.java
+++ b/src/main/java/function/builtin/FUSE.java
@@ -32,5 +32,4 @@ public class FUSE extends LispFunction {
return new Symbol(left.toString() + SEPARATOR + right.toString());
}
-
}
diff --git a/src/function/builtin/GENSYM.java b/src/main/java/function/builtin/GENSYM.java
similarity index 99%
rename from src/function/builtin/GENSYM.java
rename to src/main/java/function/builtin/GENSYM.java
index d4e21ab..a07d74d 100644
--- a/src/function/builtin/GENSYM.java
+++ b/src/main/java/function/builtin/GENSYM.java
@@ -1,7 +1,5 @@
package function.builtin;
-import java.math.BigInteger;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
@@ -9,6 +7,8 @@ import sexpression.Cons;
import sexpression.SExpression;
import sexpression.Symbol;
+import java.math.BigInteger;
+
@FunctionNames({ "GENSYM" })
public class GENSYM extends LispFunction {
@@ -39,5 +39,4 @@ public class GENSYM extends LispFunction {
return generateSymbol();
}
-
}
diff --git a/src/function/builtin/LOAD.java b/src/main/java/function/builtin/LOAD.java
similarity index 99%
rename from src/function/builtin/LOAD.java
rename to src/main/java/function/builtin/LOAD.java
index 6ec3903..3892be9 100644
--- a/src/function/builtin/LOAD.java
+++ b/src/main/java/function/builtin/LOAD.java
@@ -1,15 +1,5 @@
package function.builtin;
-import static function.builtin.EVAL.eval;
-import static java.text.MessageFormat.format;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-import static util.Path.getPathPrefix;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.Stack;
-
import environment.RuntimeEnvironment;
import error.LispException;
import error.LispWarning;
@@ -21,6 +11,16 @@ import sexpression.Cons;
import sexpression.LispString;
import sexpression.SExpression;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.Stack;
+
+import static function.builtin.EVAL.eval;
+import static java.text.MessageFormat.format;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+import static util.Path.getPathPrefix;
+
@FunctionNames({ "LOAD" })
public class LOAD extends LispFunction {
@@ -114,5 +114,4 @@ public class LOAD extends LispFunction {
return format("could not load ''{0}''", fileName);
}
}
-
}
diff --git a/src/function/builtin/PRINT.java b/src/main/java/function/builtin/PRINT.java
similarity index 99%
rename from src/function/builtin/PRINT.java
rename to src/main/java/function/builtin/PRINT.java
index 7f2a1e6..c7a77d4 100644
--- a/src/function/builtin/PRINT.java
+++ b/src/main/java/function/builtin/PRINT.java
@@ -27,5 +27,4 @@ public class PRINT extends LispFunction {
return argument;
}
-
}
diff --git a/src/function/builtin/SET.java b/src/main/java/function/builtin/SET.java
similarity index 99%
rename from src/function/builtin/SET.java
rename to src/main/java/function/builtin/SET.java
index d160d7e..ee70249 100644
--- a/src/function/builtin/SET.java
+++ b/src/main/java/function/builtin/SET.java
@@ -1,7 +1,5 @@
package function.builtin;
-import static table.FunctionTable.lookupFunction;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
@@ -11,6 +9,8 @@ import sexpression.Symbol;
import table.ExecutionContext;
import table.SymbolTable;
+import static table.FunctionTable.lookupFunction;
+
@FunctionNames({ "SET" })
public class SET extends LispFunction {
@@ -54,5 +54,4 @@ public class SET extends LispFunction {
private boolean isSymbolInTable(SExpression symbol, SymbolTable table) {
return table.contains(symbol.toString());
}
-
}
diff --git a/src/function/builtin/SYMBOLS.java b/src/main/java/function/builtin/SYMBOLS.java
similarity index 99%
rename from src/function/builtin/SYMBOLS.java
rename to src/main/java/function/builtin/SYMBOLS.java
index 38b91be..e1058a6 100644
--- a/src/function/builtin/SYMBOLS.java
+++ b/src/main/java/function/builtin/SYMBOLS.java
@@ -25,5 +25,4 @@ public class SYMBOLS extends LispFunction {
return executionContext.toList();
}
-
}
diff --git a/src/function/builtin/SYMBOL_FUNCTION.java b/src/main/java/function/builtin/SYMBOL_FUNCTION.java
similarity index 99%
rename from src/function/builtin/SYMBOL_FUNCTION.java
rename to src/main/java/function/builtin/SYMBOL_FUNCTION.java
index 95cb2aa..8f847c2 100644
--- a/src/function/builtin/SYMBOL_FUNCTION.java
+++ b/src/main/java/function/builtin/SYMBOL_FUNCTION.java
@@ -1,8 +1,5 @@
package function.builtin;
-import static java.text.MessageFormat.format;
-import static table.FunctionTable.lookupFunction;
-
import error.LispException;
import function.ArgumentValidator;
import function.FunctionNames;
@@ -13,6 +10,9 @@ import sexpression.Cons;
import sexpression.SExpression;
import sexpression.Symbol;
+import static java.text.MessageFormat.format;
+import static table.FunctionTable.lookupFunction;
+
@FunctionNames({ "SYMBOL-FUNCTION" })
public class SYMBOL_FUNCTION extends LispFunction {
@@ -60,5 +60,4 @@ public class SYMBOL_FUNCTION extends LispFunction {
return format("SYMBOL-FUNCTION: undefined function: {0}", function);
}
}
-
}
diff --git a/src/function/builtin/cons/APPEND.java b/src/main/java/function/builtin/cons/APPEND.java
similarity index 100%
rename from src/function/builtin/cons/APPEND.java
rename to src/main/java/function/builtin/cons/APPEND.java
index 3ffd146..cc7b29c 100644
--- a/src/function/builtin/cons/APPEND.java
+++ b/src/main/java/function/builtin/cons/APPEND.java
@@ -1,13 +1,13 @@
package function.builtin.cons;
-import static sexpression.Nil.NIL;
-import static table.FunctionTable.lookupFunction;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
+import static sexpression.Nil.NIL;
+import static table.FunctionTable.lookupFunction;
+
@FunctionNames({ "APPEND" })
public class APPEND extends LispFunction {
diff --git a/src/function/builtin/cons/CONS.java b/src/main/java/function/builtin/cons/CONS.java
similarity index 99%
rename from src/function/builtin/cons/CONS.java
rename to src/main/java/function/builtin/cons/CONS.java
index 6b0dc6e..3fcb453 100644
--- a/src/function/builtin/cons/CONS.java
+++ b/src/main/java/function/builtin/cons/CONS.java
@@ -26,5 +26,4 @@ public class CONS extends LispFunction {
return new Cons(firstArgument, secondArgument);
}
-
}
diff --git a/src/function/builtin/cons/FIRST.java b/src/main/java/function/builtin/cons/FIRST.java
similarity index 99%
rename from src/function/builtin/cons/FIRST.java
rename to src/main/java/function/builtin/cons/FIRST.java
index 83f9fd4..f973ae5 100644
--- a/src/function/builtin/cons/FIRST.java
+++ b/src/main/java/function/builtin/cons/FIRST.java
@@ -24,5 +24,4 @@ public class FIRST extends LispFunction {
return argument.getFirst();
}
-
}
diff --git a/src/function/builtin/cons/LENGTH.java b/src/main/java/function/builtin/cons/LENGTH.java
similarity index 99%
rename from src/function/builtin/cons/LENGTH.java
rename to src/main/java/function/builtin/cons/LENGTH.java
index 1046467..34a75bf 100644
--- a/src/function/builtin/cons/LENGTH.java
+++ b/src/main/java/function/builtin/cons/LENGTH.java
@@ -1,12 +1,5 @@
package function.builtin.cons;
-import static function.builtin.cons.LIST.makeList;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static table.FunctionTable.lookupFunction;
-
-import java.math.BigInteger;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
@@ -14,6 +7,13 @@ import recursion.TailCall;
import sexpression.Cons;
import sexpression.LispNumber;
+import java.math.BigInteger;
+
+import static function.builtin.cons.LIST.makeList;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static table.FunctionTable.lookupFunction;
+
@FunctionNames({ "LENGTH" })
public class LENGTH extends LispFunction {
@@ -62,5 +62,4 @@ public class LENGTH extends LispFunction {
private BigInteger increment(BigInteger number) {
return number.add(BigInteger.ONE);
}
-
}
diff --git a/src/function/builtin/cons/LIST.java b/src/main/java/function/builtin/cons/LIST.java
similarity index 99%
rename from src/function/builtin/cons/LIST.java
rename to src/main/java/function/builtin/cons/LIST.java
index a83271d..8a07cb4 100644
--- a/src/function/builtin/cons/LIST.java
+++ b/src/main/java/function/builtin/cons/LIST.java
@@ -1,13 +1,13 @@
package function.builtin.cons;
-import static sexpression.Nil.NIL;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+
@FunctionNames({ "LIST" })
public class LIST extends LispFunction {
@@ -27,5 +27,4 @@ public class LIST extends LispFunction {
return argumentList;
}
-
}
diff --git a/src/function/builtin/cons/REST.java b/src/main/java/function/builtin/cons/REST.java
similarity index 99%
rename from src/function/builtin/cons/REST.java
rename to src/main/java/function/builtin/cons/REST.java
index 77eb943..e8e1142 100644
--- a/src/function/builtin/cons/REST.java
+++ b/src/main/java/function/builtin/cons/REST.java
@@ -24,5 +24,4 @@ public class REST extends LispFunction {
return argument.getRest();
}
-
}
diff --git a/src/function/builtin/math/DIVIDE.java b/src/main/java/function/builtin/math/DIVIDE.java
similarity index 99%
rename from src/function/builtin/math/DIVIDE.java
rename to src/main/java/function/builtin/math/DIVIDE.java
index bee44d9..7c63391 100644
--- a/src/function/builtin/math/DIVIDE.java
+++ b/src/main/java/function/builtin/math/DIVIDE.java
@@ -1,7 +1,5 @@
package function.builtin.math;
-import java.math.BigInteger;
-
import error.LispException;
import function.ArgumentValidator;
import function.FunctionNames;
@@ -9,6 +7,8 @@ import function.LispFunction;
import sexpression.Cons;
import sexpression.LispNumber;
+import java.math.BigInteger;
+
@FunctionNames({ "/" })
public class DIVIDE extends LispFunction {
@@ -50,5 +50,4 @@ public class DIVIDE extends LispFunction {
return "divide by zero";
}
}
-
}
diff --git a/src/function/builtin/math/MINUS.java b/src/main/java/function/builtin/math/MINUS.java
similarity index 99%
rename from src/function/builtin/math/MINUS.java
rename to src/main/java/function/builtin/math/MINUS.java
index 56d725e..44e655f 100644
--- a/src/function/builtin/math/MINUS.java
+++ b/src/main/java/function/builtin/math/MINUS.java
@@ -1,13 +1,13 @@
package function.builtin.math;
-import java.math.BigInteger;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.LispNumber;
+import java.math.BigInteger;
+
@FunctionNames({ "-" })
public class MINUS extends LispFunction {
@@ -35,5 +35,4 @@ public class MINUS extends LispFunction {
private LispNumber subtract(LispNumber number1, LispNumber number2) {
return new LispNumber(number1.getValue().subtract(number2.getValue()));
}
-
}
diff --git a/src/function/builtin/math/MODULO.java b/src/main/java/function/builtin/math/MODULO.java
similarity index 99%
rename from src/function/builtin/math/MODULO.java
rename to src/main/java/function/builtin/math/MODULO.java
index b092b96..e612b70 100644
--- a/src/function/builtin/math/MODULO.java
+++ b/src/main/java/function/builtin/math/MODULO.java
@@ -41,5 +41,4 @@ public class MODULO extends LispFunction {
return "modulus not positive";
}
}
-
}
diff --git a/src/function/builtin/math/MULTIPLY.java b/src/main/java/function/builtin/math/MULTIPLY.java
similarity index 99%
rename from src/function/builtin/math/MULTIPLY.java
rename to src/main/java/function/builtin/math/MULTIPLY.java
index cbbe45b..236cfa5 100644
--- a/src/function/builtin/math/MULTIPLY.java
+++ b/src/main/java/function/builtin/math/MULTIPLY.java
@@ -1,13 +1,13 @@
package function.builtin.math;
-import static sexpression.LispNumber.ONE;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.LispNumber;
+import static sexpression.LispNumber.ONE;
+
@FunctionNames({ "*" })
public class MULTIPLY extends LispFunction {
@@ -30,5 +30,4 @@ public class MULTIPLY extends LispFunction {
private LispNumber multiply(LispNumber number1, LispNumber number2) {
return new LispNumber(number1.getValue().multiply(number2.getValue()));
}
-
}
diff --git a/src/function/builtin/math/MathFunction.java b/src/main/java/function/builtin/math/MathFunction.java
similarity index 99%
rename from src/function/builtin/math/MathFunction.java
rename to src/main/java/function/builtin/math/MathFunction.java
index ec3520a..fcd8500 100644
--- a/src/function/builtin/math/MathFunction.java
+++ b/src/main/java/function/builtin/math/MathFunction.java
@@ -1,16 +1,16 @@
package function.builtin.math;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-
-import java.util.function.BiFunction;
-import java.util.function.Function;
-
import recursion.TailCall;
import sexpression.Cons;
import sexpression.LispNumber;
import sexpression.SExpression;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+
class MathFunction {
Function singleValueOperation;
@@ -40,5 +40,4 @@ class MathFunction {
return tailCall(() -> callTailRecursive(new Cons(operationResult, remainingNumbers)));
}
-
}
diff --git a/src/function/builtin/math/PLUS.java b/src/main/java/function/builtin/math/PLUS.java
similarity index 99%
rename from src/function/builtin/math/PLUS.java
rename to src/main/java/function/builtin/math/PLUS.java
index 16677b5..785b8af 100644
--- a/src/function/builtin/math/PLUS.java
+++ b/src/main/java/function/builtin/math/PLUS.java
@@ -1,13 +1,13 @@
package function.builtin.math;
-import static sexpression.LispNumber.ZERO;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.LispNumber;
+import static sexpression.LispNumber.ZERO;
+
@FunctionNames({ "+" })
public class PLUS extends LispFunction {
@@ -30,5 +30,4 @@ public class PLUS extends LispFunction {
private LispNumber add(LispNumber number1, LispNumber number2) {
return new LispNumber(number1.getValue().add(number2.getValue()));
}
-
}
diff --git a/src/function/builtin/math/REMAINDER.java b/src/main/java/function/builtin/math/REMAINDER.java
similarity index 99%
rename from src/function/builtin/math/REMAINDER.java
rename to src/main/java/function/builtin/math/REMAINDER.java
index ede2d17..f1a367c 100644
--- a/src/function/builtin/math/REMAINDER.java
+++ b/src/main/java/function/builtin/math/REMAINDER.java
@@ -31,5 +31,4 @@ public class REMAINDER extends LispFunction {
throw new DivideByZeroException();
}
}
-
}
diff --git a/src/function/builtin/predicate/ATOM.java b/src/main/java/function/builtin/predicate/ATOM.java
similarity index 99%
rename from src/function/builtin/predicate/ATOM.java
rename to src/main/java/function/builtin/predicate/ATOM.java
index 7c0f604..a8301a6 100644
--- a/src/function/builtin/predicate/ATOM.java
+++ b/src/main/java/function/builtin/predicate/ATOM.java
@@ -1,14 +1,14 @@
package function.builtin.predicate;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "ATOM", "ATOM?" })
public class ATOM extends LispFunction {
@@ -26,5 +26,4 @@ public class ATOM extends LispFunction {
return argument.isAtom() ? T : NIL;
}
-
}
diff --git a/src/function/builtin/predicate/EQ.java b/src/main/java/function/builtin/predicate/EQ.java
similarity index 99%
rename from src/function/builtin/predicate/EQ.java
rename to src/main/java/function/builtin/predicate/EQ.java
index a659356..2dac67b 100644
--- a/src/function/builtin/predicate/EQ.java
+++ b/src/main/java/function/builtin/predicate/EQ.java
@@ -1,14 +1,14 @@
package function.builtin.predicate;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "EQ", "EQ?" })
public class EQ extends LispFunction {
@@ -52,5 +52,4 @@ public class EQ extends LispFunction {
private SExpression listEq(SExpression firstArgument, SExpression secondArgument) {
return (firstArgument == secondArgument) ? T : NIL;
}
-
}
diff --git a/src/function/builtin/predicate/EQUAL.java b/src/main/java/function/builtin/predicate/EQUAL.java
similarity index 99%
rename from src/function/builtin/predicate/EQUAL.java
rename to src/main/java/function/builtin/predicate/EQUAL.java
index 5038949..92e77ce 100644
--- a/src/function/builtin/predicate/EQUAL.java
+++ b/src/main/java/function/builtin/predicate/EQUAL.java
@@ -1,14 +1,14 @@
package function.builtin.predicate;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "EQUAL", "EQUAL?" })
public class EQUAL extends LispFunction {
@@ -37,5 +37,4 @@ public class EQUAL extends LispFunction {
private SExpression equal(SExpression firstArgument, SExpression secondArgument) {
return isEqual(firstArgument, secondArgument) ? T : NIL;
}
-
}
diff --git a/src/function/builtin/predicate/GENSYM_EQUAL.java b/src/main/java/function/builtin/predicate/GENSYM_EQUAL.java
similarity index 99%
rename from src/function/builtin/predicate/GENSYM_EQUAL.java
rename to src/main/java/function/builtin/predicate/GENSYM_EQUAL.java
index 5ce7214..9964ee9 100644
--- a/src/function/builtin/predicate/GENSYM_EQUAL.java
+++ b/src/main/java/function/builtin/predicate/GENSYM_EQUAL.java
@@ -1,8 +1,10 @@
package function.builtin.predicate;
-import static function.builtin.GENSYM.GENSYM_PREFIX;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
+import function.ArgumentValidator;
+import function.FunctionNames;
+import function.LispFunction;
+import sexpression.Cons;
+import sexpression.SExpression;
import java.util.HashMap;
import java.util.Map;
@@ -10,11 +12,9 @@ import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import function.ArgumentValidator;
-import function.FunctionNames;
-import function.LispFunction;
-import sexpression.Cons;
-import sexpression.SExpression;
+import static function.builtin.GENSYM.GENSYM_PREFIX;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
@FunctionNames({ "GENSYM-EQUAL", "GENSYM-EQUAL?" })
public class GENSYM_EQUAL extends LispFunction {
@@ -97,5 +97,4 @@ public class GENSYM_EQUAL extends LispFunction {
return equalizedExpression;
}
}
-
}
diff --git a/src/function/builtin/predicate/LISTP.java b/src/main/java/function/builtin/predicate/LISTP.java
similarity index 99%
rename from src/function/builtin/predicate/LISTP.java
rename to src/main/java/function/builtin/predicate/LISTP.java
index 32710f2..e8d0d06 100644
--- a/src/function/builtin/predicate/LISTP.java
+++ b/src/main/java/function/builtin/predicate/LISTP.java
@@ -1,14 +1,14 @@
package function.builtin.predicate;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "LISTP", "LIST?" })
public class LISTP extends LispFunction {
@@ -25,5 +25,4 @@ public class LISTP extends LispFunction {
return argumentList.getFirst().isList() ? T : NIL;
}
-
}
diff --git a/src/function/builtin/predicate/NULL.java b/src/main/java/function/builtin/predicate/NULL.java
similarity index 99%
rename from src/function/builtin/predicate/NULL.java
rename to src/main/java/function/builtin/predicate/NULL.java
index bd54ee7..216cd8c 100644
--- a/src/function/builtin/predicate/NULL.java
+++ b/src/main/java/function/builtin/predicate/NULL.java
@@ -1,14 +1,14 @@
package function.builtin.predicate;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "NULL", "NULL?" })
public class NULL extends LispFunction {
@@ -25,5 +25,4 @@ public class NULL extends LispFunction {
return argumentList.getFirst().isNull() ? T : NIL;
}
-
}
diff --git a/src/function/builtin/predicate/NUMERIC_EQUAL.java b/src/main/java/function/builtin/predicate/NUMERIC_EQUAL.java
similarity index 99%
rename from src/function/builtin/predicate/NUMERIC_EQUAL.java
rename to src/main/java/function/builtin/predicate/NUMERIC_EQUAL.java
index 76de5e4..7e11f8f 100644
--- a/src/function/builtin/predicate/NUMERIC_EQUAL.java
+++ b/src/main/java/function/builtin/predicate/NUMERIC_EQUAL.java
@@ -1,10 +1,5 @@
package function.builtin.predicate;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
@@ -13,6 +8,11 @@ import sexpression.Cons;
import sexpression.LispNumber;
import sexpression.SExpression;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "=" })
public class NUMERIC_EQUAL extends LispFunction {
@@ -51,5 +51,4 @@ public class NUMERIC_EQUAL extends LispFunction {
private boolean isEqual(LispNumber number1, LispNumber number2) {
return number1.getValue().equals(number2.getValue());
}
-
}
diff --git a/src/function/builtin/predicate/NUMERIC_GREATER.java b/src/main/java/function/builtin/predicate/NUMERIC_GREATER.java
similarity index 99%
rename from src/function/builtin/predicate/NUMERIC_GREATER.java
rename to src/main/java/function/builtin/predicate/NUMERIC_GREATER.java
index 5dbe2e4..e3dc795 100644
--- a/src/function/builtin/predicate/NUMERIC_GREATER.java
+++ b/src/main/java/function/builtin/predicate/NUMERIC_GREATER.java
@@ -1,10 +1,5 @@
package function.builtin.predicate;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
@@ -13,6 +8,11 @@ import sexpression.Cons;
import sexpression.LispNumber;
import sexpression.SExpression;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ ">" })
public class NUMERIC_GREATER extends LispFunction {
@@ -51,5 +51,4 @@ public class NUMERIC_GREATER extends LispFunction {
private boolean isFirstGreater(LispNumber number1, LispNumber number2) {
return number1.getValue().compareTo(number2.getValue()) > 0;
}
-
}
diff --git a/src/function/builtin/predicate/NUMERIC_LESS.java b/src/main/java/function/builtin/predicate/NUMERIC_LESS.java
similarity index 99%
rename from src/function/builtin/predicate/NUMERIC_LESS.java
rename to src/main/java/function/builtin/predicate/NUMERIC_LESS.java
index d70950d..ac5d8c7 100644
--- a/src/function/builtin/predicate/NUMERIC_LESS.java
+++ b/src/main/java/function/builtin/predicate/NUMERIC_LESS.java
@@ -1,10 +1,5 @@
package function.builtin.predicate;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispFunction;
@@ -13,6 +8,11 @@ import sexpression.Cons;
import sexpression.LispNumber;
import sexpression.SExpression;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "<" })
public class NUMERIC_LESS extends LispFunction {
@@ -51,5 +51,4 @@ public class NUMERIC_LESS extends LispFunction {
private boolean isFirstLesser(LispNumber number1, LispNumber number2) {
return number1.getValue().compareTo(number2.getValue()) < 0;
}
-
}
diff --git a/src/function/builtin/special/AND.java b/src/main/java/function/builtin/special/AND.java
similarity index 99%
rename from src/function/builtin/special/AND.java
rename to src/main/java/function/builtin/special/AND.java
index aa18d0c..160e431 100644
--- a/src/function/builtin/special/AND.java
+++ b/src/main/java/function/builtin/special/AND.java
@@ -1,10 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -12,6 +7,11 @@ import recursion.TailCall;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "AND" })
public class AND extends LispSpecialFunction {
@@ -40,5 +40,4 @@ public class AND extends LispSpecialFunction {
return tailCall(() -> callTailRecursive(remainingValues, currentValue));
}
-
}
diff --git a/src/function/builtin/special/CASE.java b/src/main/java/function/builtin/special/CASE.java
similarity index 99%
rename from src/function/builtin/special/CASE.java
rename to src/main/java/function/builtin/special/CASE.java
index e839f33..8cce375 100644
--- a/src/function/builtin/special/CASE.java
+++ b/src/main/java/function/builtin/special/CASE.java
@@ -1,12 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static function.builtin.predicate.EQUAL.isEqual;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -15,6 +8,13 @@ import sexpression.Cons;
import sexpression.Nil;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+import static function.builtin.predicate.EQUAL.isEqual;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
@FunctionNames({ "CASE" })
public class CASE extends LispSpecialFunction {
@@ -82,5 +82,4 @@ public class CASE extends LispSpecialFunction {
return lastConsequentValue;
}
-
}
diff --git a/src/function/builtin/special/COND.java b/src/main/java/function/builtin/special/COND.java
similarity index 99%
rename from src/function/builtin/special/COND.java
rename to src/main/java/function/builtin/special/COND.java
index 8875b91..c769a9d 100644
--- a/src/function/builtin/special/COND.java
+++ b/src/main/java/function/builtin/special/COND.java
@@ -1,10 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -13,6 +8,11 @@ import sexpression.Cons;
import sexpression.Nil;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+
@FunctionNames({ "COND" })
public class COND extends LispSpecialFunction {
@@ -65,5 +65,4 @@ public class COND extends LispSpecialFunction {
private SExpression getFirst(SExpression knownCons) {
return ((Cons) knownCons).getFirst();
}
-
}
diff --git a/src/function/builtin/special/DEFINE_SPECIAL.java b/src/main/java/function/builtin/special/DEFINE_SPECIAL.java
similarity index 99%
rename from src/function/builtin/special/DEFINE_SPECIAL.java
rename to src/main/java/function/builtin/special/DEFINE_SPECIAL.java
index 18a736e..d69d2a1 100644
--- a/src/function/builtin/special/DEFINE_SPECIAL.java
+++ b/src/main/java/function/builtin/special/DEFINE_SPECIAL.java
@@ -17,5 +17,4 @@ public class DEFINE_SPECIAL extends Define {
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
return new UserDefinedSpecialFunction(functionName.toString(), lambdaList, functionBody);
}
-
}
diff --git a/src/function/builtin/special/DEFMACRO.java b/src/main/java/function/builtin/special/DEFMACRO.java
similarity index 99%
rename from src/function/builtin/special/DEFMACRO.java
rename to src/main/java/function/builtin/special/DEFMACRO.java
index f59a33d..d228678 100644
--- a/src/function/builtin/special/DEFMACRO.java
+++ b/src/main/java/function/builtin/special/DEFMACRO.java
@@ -17,5 +17,4 @@ public class DEFMACRO extends Define {
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
return new UserDefinedMacro(functionName.toString(), lambdaList, functionBody);
}
-
}
diff --git a/src/function/builtin/special/DEFUN.java b/src/main/java/function/builtin/special/DEFUN.java
similarity index 99%
rename from src/function/builtin/special/DEFUN.java
rename to src/main/java/function/builtin/special/DEFUN.java
index d2cf917..c7fc9eb 100644
--- a/src/function/builtin/special/DEFUN.java
+++ b/src/main/java/function/builtin/special/DEFUN.java
@@ -16,5 +16,4 @@ public class DEFUN extends Define {
protected UserDefinedFunction createFunction(SExpression functionName, Cons lambdaList, Cons functionBody) {
return new UserDefinedFunction(functionName.toString(), lambdaList, functionBody);
}
-
}
diff --git a/src/function/builtin/special/Define.java b/src/main/java/function/builtin/special/Define.java
similarity index 99%
rename from src/function/builtin/special/Define.java
rename to src/main/java/function/builtin/special/Define.java
index 91697a1..22f300c 100644
--- a/src/function/builtin/special/Define.java
+++ b/src/main/java/function/builtin/special/Define.java
@@ -1,10 +1,5 @@
package function.builtin.special;
-import static function.builtin.cons.LIST.makeList;
-import static java.text.MessageFormat.format;
-import static table.FunctionTable.defineFunction;
-import static table.FunctionTable.isAlreadyDefined;
-
import environment.RuntimeEnvironment;
import error.LispWarning;
import function.ArgumentValidator;
@@ -14,6 +9,11 @@ import sexpression.Cons;
import sexpression.SExpression;
import sexpression.Symbol;
+import static function.builtin.cons.LIST.makeList;
+import static java.text.MessageFormat.format;
+import static table.FunctionTable.defineFunction;
+import static table.FunctionTable.isAlreadyDefined;
+
public abstract class Define extends LispSpecialFunction {
private ArgumentValidator argumentValidator;
@@ -74,5 +74,4 @@ public abstract class Define extends LispSpecialFunction {
return format("redefining function {0}", functionName);
}
}
-
}
diff --git a/src/function/builtin/special/IF.java b/src/main/java/function/builtin/special/IF.java
similarity index 99%
rename from src/function/builtin/special/IF.java
rename to src/main/java/function/builtin/special/IF.java
index b1b5da9..09f29a5 100644
--- a/src/function/builtin/special/IF.java
+++ b/src/main/java/function/builtin/special/IF.java
@@ -1,13 +1,13 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+
@FunctionNames({ "IF" })
public class IF extends LispSpecialFunction {
@@ -49,5 +49,4 @@ public class IF extends LispSpecialFunction {
return getRestOfList(expressions).getFirst();
}
-
}
diff --git a/src/main/java/function/builtin/special/LAMBDA.kt b/src/main/java/function/builtin/special/LAMBDA.kt
new file mode 100644
index 0000000..580f5d4
--- /dev/null
+++ b/src/main/java/function/builtin/special/LAMBDA.kt
@@ -0,0 +1,67 @@
+package function.builtin.special
+
+import function.ArgumentValidator
+import function.FunctionNames
+import function.LispSpecialFunction
+import function.UserDefinedFunction
+import function.builtin.cons.LIST.makeList
+import sexpression.Cons
+import sexpression.LambdaExpression
+import sexpression.SExpression
+import sexpression.Symbol
+
+@FunctionNames("LAMBDA", "Λ")
+class LAMBDA(name: String) : LispSpecialFunction() {
+
+ private val argumentValidator: ArgumentValidator = ArgumentValidator(name)
+ private val lambdaListValidator: ArgumentValidator = ArgumentValidator("$name|lambda-list|")
+
+ init {
+ this.argumentValidator.setFirstArgumentExpectedType(Cons::class.java)
+ this.argumentValidator.setMinimumNumberOfArguments(1)
+ this.lambdaListValidator.setEveryArgumentExpectedType(Symbol::class.java)
+ }
+
+ override fun call(argumentList: Cons): LambdaExpression {
+ argumentValidator.validate(argumentList)
+
+ val first = argumentList.first
+ val lambdaList = first as Cons
+ val body = argumentList.rest as Cons
+
+ lambdaListValidator.validate(lambdaList)
+
+ val function = UserDefinedFunction(":LAMBDA", lambdaList, body)
+
+ return LambdaExpression(makeOriginalLambdaExpression(argumentList), function)
+ }
+
+ private fun makeOriginalLambdaExpression(argumentList: Cons): Cons {
+ return Cons(Symbol("LAMBDA"), argumentList)
+ }
+
+ companion object {
+
+ fun isLambdaExpression(sexpr: SExpression): Boolean {
+ if (sexpr.isCons) {
+ val first = (sexpr as Cons).first.toString()
+
+ return "LAMBDA" == first || "Λ" == first
+ }
+
+ return false
+ }
+
+ fun createFunction(lambdaExpression: Cons): UserDefinedFunction {
+ val rest = lambdaExpression.rest
+
+ val lambdaValidator = ArgumentValidator("LAMBDA|create|")
+ lambdaValidator.setEveryArgumentExpectedType(Cons::class.java)
+ lambdaValidator.validate(makeList(rest))
+
+ val lambda = LAMBDA("LAMBDA").call(rest as Cons)
+
+ return lambda.function
+ }
+ }
+}
diff --git a/src/function/builtin/special/LET.java b/src/main/java/function/builtin/special/LET.java
similarity index 99%
rename from src/function/builtin/special/LET.java
rename to src/main/java/function/builtin/special/LET.java
index 80324d7..73112d5 100644
--- a/src/function/builtin/special/LET.java
+++ b/src/main/java/function/builtin/special/LET.java
@@ -1,8 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static sexpression.Nil.NIL;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -12,6 +9,9 @@ import sexpression.Symbol;
import table.ExecutionContext;
import table.SymbolTable;
+import static function.builtin.EVAL.eval;
+import static sexpression.Nil.NIL;
+
@FunctionNames({ "LET" })
public class LET extends LispSpecialFunction {
@@ -90,5 +90,4 @@ public class LET extends LispSpecialFunction {
private void restorePreviousScope(SymbolTable localScope) {
executionContext.setScope(localScope.getParent());
}
-
}
diff --git a/src/function/builtin/special/LET_STAR.java b/src/main/java/function/builtin/special/LET_STAR.java
similarity index 99%
rename from src/function/builtin/special/LET_STAR.java
rename to src/main/java/function/builtin/special/LET_STAR.java
index 39dca55..41373c5 100644
--- a/src/function/builtin/special/LET_STAR.java
+++ b/src/main/java/function/builtin/special/LET_STAR.java
@@ -19,5 +19,4 @@ public class LET_STAR extends LET {
return localScope;
}
-
}
diff --git a/src/function/builtin/special/OR.java b/src/main/java/function/builtin/special/OR.java
similarity index 99%
rename from src/function/builtin/special/OR.java
rename to src/main/java/function/builtin/special/OR.java
index 43ec14e..c18772e 100644
--- a/src/function/builtin/special/OR.java
+++ b/src/main/java/function/builtin/special/OR.java
@@ -1,9 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -11,6 +7,10 @@ import recursion.TailCall;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+
@FunctionNames({ "OR" })
public class OR extends LispSpecialFunction {
@@ -36,5 +36,4 @@ public class OR extends LispSpecialFunction {
return tailCall(() -> callTailRecursive(remainingValues));
}
-
}
diff --git a/src/function/builtin/special/PROGN.java b/src/main/java/function/builtin/special/PROGN.java
similarity index 99%
rename from src/function/builtin/special/PROGN.java
rename to src/main/java/function/builtin/special/PROGN.java
index be97589..12f1a47 100644
--- a/src/function/builtin/special/PROGN.java
+++ b/src/main/java/function/builtin/special/PROGN.java
@@ -1,10 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static recursion.TailCalls.done;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -12,6 +7,11 @@ import recursion.TailCall;
import sexpression.Cons;
import sexpression.SExpression;
+import static function.builtin.EVAL.eval;
+import static recursion.TailCalls.done;
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+
@FunctionNames({ "PROGN", "BEGIN" })
public class PROGN extends LispSpecialFunction {
@@ -37,5 +37,4 @@ public class PROGN extends LispSpecialFunction {
return tailCall(() -> callTailRecursive(remainingValues, currentValue));
}
-
}
diff --git a/src/function/builtin/special/QUOTE.java b/src/main/java/function/builtin/special/QUOTE.java
similarity index 99%
rename from src/function/builtin/special/QUOTE.java
rename to src/main/java/function/builtin/special/QUOTE.java
index 7952140..e0bcb3b 100644
--- a/src/function/builtin/special/QUOTE.java
+++ b/src/main/java/function/builtin/special/QUOTE.java
@@ -22,5 +22,4 @@ public class QUOTE extends LispSpecialFunction {
return argumentList.getFirst();
}
-
}
diff --git a/src/function/builtin/special/RECUR.java b/src/main/java/function/builtin/special/RECUR.java
similarity index 99%
rename from src/function/builtin/special/RECUR.java
rename to src/main/java/function/builtin/special/RECUR.java
index 4d025f0..f3006d4 100644
--- a/src/function/builtin/special/RECUR.java
+++ b/src/main/java/function/builtin/special/RECUR.java
@@ -1,7 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.evaluateFunctionArgumentList;
-
import error.LispException;
import function.ArgumentValidator;
import function.FunctionNames;
@@ -10,6 +8,8 @@ import sexpression.Cons;
import sexpression.SExpression;
import table.ExecutionContext;
+import static function.builtin.EVAL.evaluateFunctionArgumentList;
+
@FunctionNames({ "RECUR" })
public class RECUR extends LispSpecialFunction {
@@ -87,5 +87,4 @@ public class RECUR extends LispSpecialFunction {
return "recur not in tail position";
}
}
-
}
diff --git a/src/function/builtin/special/SETQ.java b/src/main/java/function/builtin/special/SETQ.java
similarity index 99%
rename from src/function/builtin/special/SETQ.java
rename to src/main/java/function/builtin/special/SETQ.java
index 0dc6229..b38340c 100644
--- a/src/function/builtin/special/SETQ.java
+++ b/src/main/java/function/builtin/special/SETQ.java
@@ -1,9 +1,5 @@
package function.builtin.special;
-import static function.builtin.EVAL.eval;
-import static function.builtin.SET.set;
-import static function.builtin.cons.LIST.makeList;
-
import function.ArgumentValidator;
import function.FunctionNames;
import function.LispSpecialFunction;
@@ -11,6 +7,10 @@ import sexpression.Cons;
import sexpression.SExpression;
import sexpression.Symbol;
+import static function.builtin.EVAL.eval;
+import static function.builtin.SET.set;
+import static function.builtin.cons.LIST.makeList;
+
@FunctionNames({ "SETQ" })
public class SETQ extends LispSpecialFunction {
@@ -35,5 +35,4 @@ public class SETQ extends LispSpecialFunction {
return new Cons(argumentList.getFirst(), makeList(value));
}
-
}
diff --git a/src/interpreter/FileLispInterpreter.java b/src/main/java/interpreter/FileLispInterpreter.java
similarity index 99%
rename from src/interpreter/FileLispInterpreter.java
rename to src/main/java/interpreter/FileLispInterpreter.java
index f5c0288..8b6bd98 100644
--- a/src/interpreter/FileLispInterpreter.java
+++ b/src/main/java/interpreter/FileLispInterpreter.java
@@ -25,5 +25,4 @@ public class FileLispInterpreter extends LispInterpreter {
super.applyFinishingTouches();
}
-
}
diff --git a/src/interpreter/InteractiveLispInterpreter.java b/src/main/java/interpreter/InteractiveLispInterpreter.java
similarity index 99%
rename from src/interpreter/InteractiveLispInterpreter.java
rename to src/main/java/interpreter/InteractiveLispInterpreter.java
index 94fb537..f326475 100644
--- a/src/interpreter/InteractiveLispInterpreter.java
+++ b/src/main/java/interpreter/InteractiveLispInterpreter.java
@@ -21,5 +21,4 @@ public class InteractiveLispInterpreter extends LispInterpreter {
environment.getOutput().println(environment.decoratePrompt(""));
environment.getOutput().flush();
}
-
}
diff --git a/src/interpreter/LispInterpreter.java b/src/main/java/interpreter/LispInterpreter.java
similarity index 99%
rename from src/interpreter/LispInterpreter.java
rename to src/main/java/interpreter/LispInterpreter.java
index 36f6a92..c0f4cdf 100644
--- a/src/interpreter/LispInterpreter.java
+++ b/src/main/java/interpreter/LispInterpreter.java
@@ -1,15 +1,15 @@
package interpreter;
-import static function.builtin.EVAL.eval;
-
-import java.io.InputStream;
-import java.util.List;
-
import environment.RuntimeEnvironment;
import error.LispException;
import parser.LispParser;
import sexpression.SExpression;
+import java.io.InputStream;
+import java.util.List;
+
+import static function.builtin.EVAL.eval;
+
public class LispInterpreter {
protected RuntimeEnvironment environment;
@@ -90,5 +90,4 @@ public class LispInterpreter {
return name;
}
}
-
}
diff --git a/src/interpreter/LispInterpreterBuilder.java b/src/main/java/interpreter/LispInterpreterBuilder.java
similarity index 99%
rename from src/interpreter/LispInterpreterBuilder.java
rename to src/main/java/interpreter/LispInterpreterBuilder.java
index c21a02c..ff6267b 100644
--- a/src/interpreter/LispInterpreterBuilder.java
+++ b/src/main/java/interpreter/LispInterpreterBuilder.java
@@ -35,5 +35,4 @@ public interface LispInterpreterBuilder {
LispInterpreter build();
default void reset() {}
-
}
diff --git a/src/interpreter/LispInterpreterBuilderImpl.java b/src/main/java/interpreter/LispInterpreterBuilderImpl.java
similarity index 99%
rename from src/interpreter/LispInterpreterBuilderImpl.java
rename to src/main/java/interpreter/LispInterpreterBuilderImpl.java
index 5524074..921fb1f 100644
--- a/src/interpreter/LispInterpreterBuilderImpl.java
+++ b/src/main/java/interpreter/LispInterpreterBuilderImpl.java
@@ -1,6 +1,9 @@
package interpreter;
-import static util.Path.getPathPrefix;
+import environment.RuntimeEnvironment;
+import error.CriticalLispException;
+import error.ErrorManager;
+import interpreter.LispInterpreter.LanguageFile;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -10,10 +13,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
-import environment.RuntimeEnvironment;
-import error.CriticalLispException;
-import error.ErrorManager;
-import interpreter.LispInterpreter.LanguageFile;
+import static util.Path.getPathPrefix;
public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
@@ -63,7 +63,6 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
@Override
public void setOutput(PrintStream outputStream) {
this.outputStream = outputStream;
-
}
@Override
@@ -115,13 +114,11 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
@Override
public void setWarningOutputDecorator(Function decorator) {
this.warningOutputDecorator = decorator;
-
}
@Override
public void setErrorOutputDecorator(Function decorator) {
this.errorOutputDecorator = decorator;
-
}
@Override
@@ -217,5 +214,4 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
return message;
}
}
-
}
diff --git a/src/parser/LispParser.java b/src/main/java/parser/LispParser.java
similarity index 99%
rename from src/parser/LispParser.java
rename to src/main/java/parser/LispParser.java
index e28ff58..041584f 100644
--- a/src/parser/LispParser.java
+++ b/src/main/java/parser/LispParser.java
@@ -1,13 +1,13 @@
package parser;
-import java.io.InputStream;
-
import error.LispException;
import scanner.LispScanner;
import sexpression.SExpression;
import token.Eof;
import token.Token;
+import java.io.InputStream;
+
/**
* Converts a stream of bytes into internal representations of Lisp s-expressions.
*/
@@ -60,5 +60,4 @@ public class LispParser {
throw exceptionToThrow;
}
}
-
}
diff --git a/src/recursion/TailCall.java b/src/main/java/recursion/TailCall.java
similarity index 90%
rename from src/recursion/TailCall.java
rename to src/main/java/recursion/TailCall.java
index 260425f..0facd50 100644
--- a/src/recursion/TailCall.java
+++ b/src/main/java/recursion/TailCall.java
@@ -16,15 +16,10 @@ public interface TailCall {
}
default T invoke() {
- // @formatter:off
-
return Stream.iterate(this, TailCall::apply)
.filter(TailCall::isComplete)
.findFirst()
.get()
.result();
-
- // @formatter:on
}
-
}
diff --git a/src/recursion/TailCalls.java b/src/main/java/recursion/TailCalls.java
similarity index 99%
rename from src/recursion/TailCalls.java
rename to src/main/java/recursion/TailCalls.java
index f5137b6..3950b2f 100644
--- a/src/recursion/TailCalls.java
+++ b/src/main/java/recursion/TailCalls.java
@@ -25,5 +25,4 @@ public class TailCalls {
}
};
}
-
}
\ No newline at end of file
diff --git a/src/scanner/LispCommentRemovingInputStream.java b/src/main/java/scanner/LispCommentRemovingInputStream.java
similarity index 99%
rename from src/scanner/LispCommentRemovingInputStream.java
rename to src/main/java/scanner/LispCommentRemovingInputStream.java
index 084a34d..5155978 100644
--- a/src/scanner/LispCommentRemovingInputStream.java
+++ b/src/main/java/scanner/LispCommentRemovingInputStream.java
@@ -1,15 +1,15 @@
package scanner;
+import stream.SafeInputStream;
+
+import java.io.InputStream;
+
import static util.Characters.BACKSLASH;
import static util.Characters.DOUBLE_QUOTE;
import static util.Characters.EOF;
import static util.Characters.NEWLINE;
import static util.Characters.SEMICOLON;
-import java.io.InputStream;
-
-import stream.SafeInputStream;
-
/**
* Removes Lisp comments from an input stream.
*/
@@ -80,5 +80,4 @@ public class LispCommentRemovingInputStream implements LispInputStream {
this.rereadLastCharacter = true;
}
-
}
diff --git a/src/scanner/LispInputStream.java b/src/main/java/scanner/LispInputStream.java
similarity index 99%
rename from src/scanner/LispInputStream.java
rename to src/main/java/scanner/LispInputStream.java
index 014afd0..aa856a0 100644
--- a/src/scanner/LispInputStream.java
+++ b/src/main/java/scanner/LispInputStream.java
@@ -12,5 +12,4 @@ public interface LispInputStream {
private static final long serialVersionUID = 1L;
}
-
}
diff --git a/src/scanner/LispScanner.java b/src/main/java/scanner/LispScanner.java
similarity index 99%
rename from src/scanner/LispScanner.java
rename to src/main/java/scanner/LispScanner.java
index 3e58834..8d267c3 100644
--- a/src/scanner/LispScanner.java
+++ b/src/main/java/scanner/LispScanner.java
@@ -1,5 +1,16 @@
package scanner;
+import error.LineColumnException;
+import file.FilePosition;
+import file.FilePositionTracker;
+import token.Token;
+import token.TokenFactory;
+import token.TokenFactoryImpl;
+import util.Characters;
+
+import java.io.InputStream;
+import java.util.function.Function;
+
import static java.lang.Character.isDigit;
import static java.lang.Character.isWhitespace;
import static util.Characters.BACKSLASH;
@@ -9,17 +20,6 @@ import static util.Characters.NEWLINE;
import static util.Characters.isLegalIdentifierCharacter;
import static util.Characters.isNumberPrefix;
-import java.io.InputStream;
-import java.util.function.Function;
-
-import error.LineColumnException;
-import file.FilePosition;
-import file.FilePositionTracker;
-import token.Token;
-import token.TokenFactory;
-import token.TokenFactoryImpl;
-import util.Characters;
-
/**
* Converts a stream of bytes into a stream of Lisp tokens.
*/
@@ -183,5 +183,4 @@ public class LispScanner {
return "unterminated quoted string";
}
}
-
}
diff --git a/src/sexpression/AtSignExpression.java b/src/main/java/sexpression/AtSignExpression.java
similarity index 99%
rename from src/sexpression/AtSignExpression.java
rename to src/main/java/sexpression/AtSignExpression.java
index bb73362..98c3008 100644
--- a/src/sexpression/AtSignExpression.java
+++ b/src/main/java/sexpression/AtSignExpression.java
@@ -21,5 +21,4 @@ public class AtSignExpression extends SExpression {
public String toString() {
return "@" + expression;
}
-
}
diff --git a/src/sexpression/Atom.java b/src/main/java/sexpression/Atom.java
similarity index 99%
rename from src/sexpression/Atom.java
rename to src/main/java/sexpression/Atom.java
index 69c973b..14ff7b1 100644
--- a/src/sexpression/Atom.java
+++ b/src/main/java/sexpression/Atom.java
@@ -18,5 +18,4 @@ public abstract class Atom extends SExpression {
public String toString() {
return text;
}
-
}
diff --git a/src/sexpression/BackquoteExpression.java b/src/main/java/sexpression/BackquoteExpression.java
similarity index 99%
rename from src/sexpression/BackquoteExpression.java
rename to src/main/java/sexpression/BackquoteExpression.java
index ec88673..ec59adc 100644
--- a/src/sexpression/BackquoteExpression.java
+++ b/src/main/java/sexpression/BackquoteExpression.java
@@ -21,5 +21,4 @@ public class BackquoteExpression extends SExpression {
public String toString() {
return "`" + expression;
}
-
}
diff --git a/src/sexpression/CommaExpression.java b/src/main/java/sexpression/CommaExpression.java
similarity index 99%
rename from src/sexpression/CommaExpression.java
rename to src/main/java/sexpression/CommaExpression.java
index b10b7a6..71e4744 100644
--- a/src/sexpression/CommaExpression.java
+++ b/src/main/java/sexpression/CommaExpression.java
@@ -21,5 +21,4 @@ public class CommaExpression extends SExpression {
public String toString() {
return "," + expression;
}
-
}
diff --git a/src/sexpression/Cons.java b/src/main/java/sexpression/Cons.java
similarity index 99%
rename from src/sexpression/Cons.java
rename to src/main/java/sexpression/Cons.java
index 4789224..fa2d1b7 100644
--- a/src/sexpression/Cons.java
+++ b/src/main/java/sexpression/Cons.java
@@ -1,10 +1,10 @@
package sexpression;
+import recursion.TailCall;
+
import static recursion.TailCalls.done;
import static recursion.TailCalls.tailCall;
-import recursion.TailCall;
-
@DisplayName("list")
public class Cons extends SExpression {
@@ -53,5 +53,4 @@ public class Cons extends SExpression {
return done(leadingString.append(" . " + rest.toString() + ")").toString());
}
-
}
diff --git a/src/sexpression/DisplayName.java b/src/main/java/sexpression/DisplayName.java
similarity index 99%
rename from src/sexpression/DisplayName.java
rename to src/main/java/sexpression/DisplayName.java
index fc97d80..d116ce7 100644
--- a/src/sexpression/DisplayName.java
+++ b/src/main/java/sexpression/DisplayName.java
@@ -10,5 +10,4 @@ import java.lang.annotation.Target;
public @interface DisplayName {
String value();
-
}
diff --git a/src/sexpression/LambdaExpression.java b/src/main/java/sexpression/LambdaExpression.java
similarity index 99%
rename from src/sexpression/LambdaExpression.java
rename to src/main/java/sexpression/LambdaExpression.java
index 04a9d5c..0c46ebc 100644
--- a/src/sexpression/LambdaExpression.java
+++ b/src/main/java/sexpression/LambdaExpression.java
@@ -30,5 +30,4 @@ public class LambdaExpression extends SExpression {
public String toString() {
return lambdaExpression.toString();
}
-
}
diff --git a/src/sexpression/LispNumber.java b/src/main/java/sexpression/LispNumber.java
similarity index 99%
rename from src/sexpression/LispNumber.java
rename to src/main/java/sexpression/LispNumber.java
index bb00a96..696e64b 100644
--- a/src/sexpression/LispNumber.java
+++ b/src/main/java/sexpression/LispNumber.java
@@ -1,10 +1,10 @@
package sexpression;
-import static java.text.MessageFormat.format;
+import error.LispException;
import java.math.BigInteger;
-import error.LispException;
+import static java.text.MessageFormat.format;
@DisplayName("number")
public class LispNumber extends Atom {
@@ -53,5 +53,4 @@ public class LispNumber extends Atom {
return format("{0} is not a valid integer", text);
}
}
-
}
diff --git a/src/sexpression/LispString.java b/src/main/java/sexpression/LispString.java
similarity index 99%
rename from src/sexpression/LispString.java
rename to src/main/java/sexpression/LispString.java
index 89898ff..e433eac 100644
--- a/src/sexpression/LispString.java
+++ b/src/main/java/sexpression/LispString.java
@@ -11,5 +11,4 @@ public class LispString extends Atom {
public boolean isString() {
return true;
}
-
}
diff --git a/src/sexpression/Nil.java b/src/main/java/sexpression/Nil.java
similarity index 99%
rename from src/sexpression/Nil.java
rename to src/main/java/sexpression/Nil.java
index cf3bc9a..6192673 100644
--- a/src/sexpression/Nil.java
+++ b/src/main/java/sexpression/Nil.java
@@ -48,5 +48,4 @@ public class Nil extends Cons {
public String toString() {
return "NIL";
}
-
}
diff --git a/src/sexpression/SExpression.java b/src/main/java/sexpression/SExpression.java
similarity index 99%
rename from src/sexpression/SExpression.java
rename to src/main/java/sexpression/SExpression.java
index acc99ed..476bf97 100644
--- a/src/sexpression/SExpression.java
+++ b/src/main/java/sexpression/SExpression.java
@@ -46,5 +46,4 @@ public abstract class SExpression {
public boolean isAtSign() {
return false;
}
-
}
diff --git a/src/sexpression/Symbol.java b/src/main/java/sexpression/Symbol.java
similarity index 99%
rename from src/sexpression/Symbol.java
rename to src/main/java/sexpression/Symbol.java
index ae6e032..3e998b9 100644
--- a/src/sexpression/Symbol.java
+++ b/src/main/java/sexpression/Symbol.java
@@ -19,5 +19,4 @@ public class Symbol extends Atom {
public boolean isSymbol() {
return true;
}
-
}
diff --git a/src/stream/SafeInputStream.java b/src/main/java/stream/SafeInputStream.java
similarity index 99%
rename from src/stream/SafeInputStream.java
rename to src/main/java/stream/SafeInputStream.java
index e817994..5632f8f 100644
--- a/src/stream/SafeInputStream.java
+++ b/src/main/java/stream/SafeInputStream.java
@@ -1,11 +1,11 @@
package stream;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
public class SafeInputStream {
private InputStreamReader underlyingStream;
@@ -29,5 +29,4 @@ public class SafeInputStream {
throw new UncheckedIOException(e);
}
}
-
}
\ No newline at end of file
diff --git a/src/stream/SafeOutputStream.java b/src/main/java/stream/SafeOutputStream.java
similarity index 99%
rename from src/stream/SafeOutputStream.java
rename to src/main/java/stream/SafeOutputStream.java
index e82beae..effde5f 100644
--- a/src/stream/SafeOutputStream.java
+++ b/src/main/java/stream/SafeOutputStream.java
@@ -35,5 +35,4 @@ public class SafeOutputStream {
throw new UncheckedIOException(e);
}
}
-
}
\ No newline at end of file
diff --git a/src/stream/UncheckedIOException.java b/src/main/java/stream/UncheckedIOException.java
similarity index 99%
rename from src/stream/UncheckedIOException.java
rename to src/main/java/stream/UncheckedIOException.java
index de93070..dee1aa6 100644
--- a/src/stream/UncheckedIOException.java
+++ b/src/main/java/stream/UncheckedIOException.java
@@ -1,9 +1,9 @@
package stream;
-import java.io.IOException;
-
import error.CriticalLispException;
+import java.io.IOException;
+
public class UncheckedIOException extends CriticalLispException {
private static final long serialVersionUID = 1L;
@@ -17,5 +17,4 @@ public class UncheckedIOException extends CriticalLispException {
public String getMessage() {
return exception.getMessage();
}
-
}
\ No newline at end of file
diff --git a/src/table/ExecutionContext.java b/src/main/java/table/ExecutionContext.java
similarity index 100%
rename from src/table/ExecutionContext.java
rename to src/main/java/table/ExecutionContext.java
index 6a24be7..a20d3df 100644
--- a/src/table/ExecutionContext.java
+++ b/src/main/java/table/ExecutionContext.java
@@ -1,13 +1,13 @@
package table;
-import static sexpression.Nil.NIL;
-
-import java.util.Stack;
-
import function.LispFunction;
import sexpression.Cons;
import sexpression.SExpression;
+import java.util.Stack;
+
+import static sexpression.Nil.NIL;
+
public class ExecutionContext {
private static ExecutionContext uniqueInstance = new ExecutionContext();
diff --git a/src/table/FunctionTable.java b/src/main/java/table/FunctionTable.java
similarity index 99%
rename from src/table/FunctionTable.java
rename to src/main/java/table/FunctionTable.java
index 8a82eba..5ee5038 100644
--- a/src/table/FunctionTable.java
+++ b/src/main/java/table/FunctionTable.java
@@ -1,12 +1,5 @@
package table;
-import static java.text.MessageFormat.format;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
import error.CriticalLispException;
import function.FunctionNames;
import function.LispFunction;
@@ -58,6 +51,13 @@ import function.builtin.special.QUOTE;
import function.builtin.special.RECUR;
import function.builtin.special.SETQ;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static java.text.MessageFormat.format;
+
public class FunctionTable {
private static Set> allBuiltIns = new HashSet<>();
@@ -197,5 +197,4 @@ public class FunctionTable {
return format("Could not create an instance of ''{0}''", functionName);
}
}
-
}
diff --git a/src/table/SymbolTable.java b/src/main/java/table/SymbolTable.java
similarity index 99%
rename from src/table/SymbolTable.java
rename to src/main/java/table/SymbolTable.java
index 0088983..b04636b 100644
--- a/src/table/SymbolTable.java
+++ b/src/main/java/table/SymbolTable.java
@@ -1,17 +1,17 @@
package table;
-import static function.builtin.cons.APPEND.append;
-import static function.builtin.cons.LIST.makeList;
-import static sexpression.Nil.NIL;
+import sexpression.Cons;
+import sexpression.SExpression;
+import sexpression.Symbol;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
-import sexpression.Cons;
-import sexpression.SExpression;
-import sexpression.Symbol;
+import static function.builtin.cons.APPEND.append;
+import static function.builtin.cons.LIST.makeList;
+import static sexpression.Nil.NIL;
public class SymbolTable {
@@ -63,5 +63,4 @@ public class SymbolTable {
private Cons makeSymbolValuePair(Entry binding) {
return new Cons(new Symbol(binding.getKey()), makeList(binding.getValue()));
}
-
}
diff --git a/src/terminal/ControlSequence.java b/src/main/java/terminal/ControlSequence.java
similarity index 100%
rename from src/terminal/ControlSequence.java
rename to src/main/java/terminal/ControlSequence.java
diff --git a/src/terminal/ControlSequenceHandler.java b/src/main/java/terminal/ControlSequenceHandler.java
similarity index 99%
rename from src/terminal/ControlSequenceHandler.java
rename to src/main/java/terminal/ControlSequenceHandler.java
index fa4a4c3..51e5cd0 100644
--- a/src/terminal/ControlSequenceHandler.java
+++ b/src/main/java/terminal/ControlSequenceHandler.java
@@ -1,12 +1,12 @@
package terminal;
+import stream.SafeInputStream;
+
import static java.lang.Character.isDigit;
import static util.Characters.EOF;
import static util.Characters.LEFT_SQUARE_BRACKET;
import static util.Characters.UNICODE_ESCAPE;
-import stream.SafeInputStream;
-
class ControlSequenceHandler {
public static final boolean isEscape(char c) {
@@ -57,5 +57,4 @@ class ControlSequenceHandler {
private boolean isPartOfCode() {
return isCharacter() && isDigit((char) currentCharacter);
}
-
}
diff --git a/src/terminal/ControlSequenceLookup.java b/src/main/java/terminal/ControlSequenceLookup.java
similarity index 99%
rename from src/terminal/ControlSequenceLookup.java
rename to src/main/java/terminal/ControlSequenceLookup.java
index 59b3f9a..2cec30a 100644
--- a/src/terminal/ControlSequenceLookup.java
+++ b/src/main/java/terminal/ControlSequenceLookup.java
@@ -1,11 +1,11 @@
package terminal;
-import static terminal.SelectGraphicRendition.SGR_COMMAND;
+import terminal.ControlSequence.NullControlSequence;
import java.util.HashMap;
import java.util.Map;
-import terminal.ControlSequence.NullControlSequence;
+import static terminal.SelectGraphicRendition.SGR_COMMAND;
public class ControlSequenceLookup {
@@ -31,5 +31,4 @@ public class ControlSequenceLookup {
return codes.getOrDefault(code, new NullControlSequence());
}
-
}
\ No newline at end of file
diff --git a/src/terminal/LispTerminal.java b/src/main/java/terminal/LispTerminal.java
similarity index 99%
rename from src/terminal/LispTerminal.java
rename to src/main/java/terminal/LispTerminal.java
index 771c860..99dee32 100644
--- a/src/terminal/LispTerminal.java
+++ b/src/main/java/terminal/LispTerminal.java
@@ -1,5 +1,17 @@
package terminal;
+import com.googlecode.lanterna.TerminalPosition;
+import com.googlecode.lanterna.TerminalSize;
+import com.googlecode.lanterna.input.KeyStroke;
+import com.googlecode.lanterna.input.KeyType;
+import com.googlecode.lanterna.terminal.IOSafeTerminal;
+import stream.SafeInputStream;
+import stream.SafeOutputStream;
+
+import java.io.ByteArrayInputStream;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
import static com.googlecode.lanterna.input.KeyType.ArrowDown;
import static com.googlecode.lanterna.input.KeyType.ArrowLeft;
import static com.googlecode.lanterna.input.KeyType.ArrowRight;
@@ -12,19 +24,6 @@ import static terminal.ControlSequenceHandler.isEscape;
import static util.Characters.EOF;
import static util.Characters.UNICODE_NULL;
-import java.io.ByteArrayInputStream;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import com.googlecode.lanterna.TerminalPosition;
-import com.googlecode.lanterna.TerminalSize;
-import com.googlecode.lanterna.input.KeyStroke;
-import com.googlecode.lanterna.input.KeyType;
-import com.googlecode.lanterna.terminal.IOSafeTerminal;
-
-import stream.SafeInputStream;
-import stream.SafeOutputStream;
-
public class LispTerminal {
public static final char END_OF_SEGMENT = UNICODE_NULL;
@@ -393,7 +392,8 @@ public class LispTerminal {
private void takeNap() {
try {
Thread.sleep(1);
- } catch (InterruptedException ignored) {}
+ } catch (InterruptedException ignored) {
+ }
}
private void writeOutput() {
@@ -458,5 +458,4 @@ public class LispTerminal {
isStopped = true;
inputWriter.close();
}
-
}
diff --git a/src/terminal/SelectGraphicRendition.java b/src/main/java/terminal/SelectGraphicRendition.java
similarity index 99%
rename from src/terminal/SelectGraphicRendition.java
rename to src/main/java/terminal/SelectGraphicRendition.java
index aa71a4c..9b4d9b5 100644
--- a/src/terminal/SelectGraphicRendition.java
+++ b/src/main/java/terminal/SelectGraphicRendition.java
@@ -6,7 +6,6 @@ import com.googlecode.lanterna.terminal.IOSafeTerminal;
public enum SelectGraphicRendition implements ControlSequence {
RESET {
-
@Override
public String getCode() {
return "0";
@@ -19,7 +18,6 @@ public enum SelectGraphicRendition implements ControlSequence {
},
RED {
-
@Override
public String getCode() {
return "31";
@@ -32,7 +30,6 @@ public enum SelectGraphicRendition implements ControlSequence {
},
GREEN {
-
@Override
public String getCode() {
return "32";
@@ -45,7 +42,6 @@ public enum SelectGraphicRendition implements ControlSequence {
},
YELLOW {
-
@Override
public String getCode() {
return "33";
@@ -58,7 +54,6 @@ public enum SelectGraphicRendition implements ControlSequence {
},
PURPLE {
-
@Override
public String getCode() {
return "35";
diff --git a/src/terminal/TerminalConfiguration.java b/src/main/java/terminal/TerminalConfiguration.java
similarity index 99%
rename from src/terminal/TerminalConfiguration.java
rename to src/main/java/terminal/TerminalConfiguration.java
index 0a26a35..c6173f6 100644
--- a/src/terminal/TerminalConfiguration.java
+++ b/src/main/java/terminal/TerminalConfiguration.java
@@ -1,13 +1,12 @@
package terminal;
+import com.googlecode.lanterna.terminal.IOSafeTerminal;
+import stream.UncheckedIOException;
+
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import com.googlecode.lanterna.terminal.IOSafeTerminal;
-
-import stream.UncheckedIOException;
-
public class TerminalConfiguration {
private PipedOutputStream inputWriter;
@@ -67,5 +66,4 @@ public class TerminalConfiguration {
public IOSafeTerminal getTerminal() {
return terminal;
}
-
}
\ No newline at end of file
diff --git a/src/terminal/TerminalHistory.java b/src/main/java/terminal/TerminalHistory.java
similarity index 99%
rename from src/terminal/TerminalHistory.java
rename to src/main/java/terminal/TerminalHistory.java
index e2b6f25..63fb0ca 100644
--- a/src/terminal/TerminalHistory.java
+++ b/src/main/java/terminal/TerminalHistory.java
@@ -49,5 +49,4 @@ public class TerminalHistory {
public boolean isEnd() {
return lineIndex == lastIndex();
}
-
}
diff --git a/src/token/AtSign.java b/src/main/java/token/AtSign.java
similarity index 99%
rename from src/token/AtSign.java
rename to src/main/java/token/AtSign.java
index d057b5e..0f045d0 100644
--- a/src/token/AtSign.java
+++ b/src/main/java/token/AtSign.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.AtSignExpression;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class AtSign extends Token {
public AtSign(String text, FilePosition position) {
@@ -19,5 +19,4 @@ public class AtSign extends Token {
return new AtSignExpression(argument);
}
-
}
diff --git a/src/token/Backquote.java b/src/main/java/token/Backquote.java
similarity index 99%
rename from src/token/Backquote.java
rename to src/main/java/token/Backquote.java
index 4b10cbe..427f4e8 100644
--- a/src/token/Backquote.java
+++ b/src/main/java/token/Backquote.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.BackquoteExpression;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class Backquote extends Token {
public Backquote(String text, FilePosition position) {
@@ -19,5 +19,4 @@ public class Backquote extends Token {
return new BackquoteExpression(argument);
}
-
}
diff --git a/src/token/Comma.java b/src/main/java/token/Comma.java
similarity index 99%
rename from src/token/Comma.java
rename to src/main/java/token/Comma.java
index 0a419fe..5944e84 100644
--- a/src/token/Comma.java
+++ b/src/main/java/token/Comma.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.CommaExpression;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class Comma extends Token {
public Comma(String text, FilePosition position) {
@@ -19,5 +19,4 @@ public class Comma extends Token {
return new CommaExpression(argument);
}
-
}
diff --git a/src/token/Eof.java b/src/main/java/token/Eof.java
similarity index 99%
rename from src/token/Eof.java
rename to src/main/java/token/Eof.java
index 4034a6b..a308db7 100644
--- a/src/token/Eof.java
+++ b/src/main/java/token/Eof.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import error.LineColumnException;
import file.FilePosition;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class Eof extends Token {
public Eof(String text, FilePosition position) {
@@ -30,5 +30,4 @@ public class Eof extends Token {
return "end-of-file encountered";
}
}
-
}
diff --git a/src/token/Identifier.java b/src/main/java/token/Identifier.java
similarity index 99%
rename from src/token/Identifier.java
rename to src/main/java/token/Identifier.java
index f425de4..402be86 100644
--- a/src/token/Identifier.java
+++ b/src/main/java/token/Identifier.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.SExpression;
import sexpression.Symbol;
+import java.util.function.Supplier;
+
public class Identifier extends Token {
public Identifier(String text, FilePosition position) {
@@ -16,5 +16,4 @@ public class Identifier extends Token {
public SExpression parseSExpression(Supplier getNextToken) {
return new Symbol(getText());
}
-
}
diff --git a/src/token/LeftParenthesis.java b/src/main/java/token/LeftParenthesis.java
similarity index 99%
rename from src/token/LeftParenthesis.java
rename to src/main/java/token/LeftParenthesis.java
index 1f27542..c63a5b6 100644
--- a/src/token/LeftParenthesis.java
+++ b/src/main/java/token/LeftParenthesis.java
@@ -1,10 +1,10 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class LeftParenthesis extends Token {
public LeftParenthesis(String text, FilePosition position) {
@@ -17,5 +17,4 @@ public class LeftParenthesis extends Token {
return nextToken.parseListTail(getNextToken).invoke();
}
-
}
diff --git a/src/token/Number.java b/src/main/java/token/Number.java
similarity index 99%
rename from src/token/Number.java
rename to src/main/java/token/Number.java
index dad0d82..8c78eb1 100644
--- a/src/token/Number.java
+++ b/src/main/java/token/Number.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.LispNumber;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class Number extends Token {
public Number(String text, FilePosition position) {
@@ -16,5 +16,4 @@ public class Number extends Token {
public SExpression parseSExpression(Supplier getNextToken) {
return new LispNumber(getText());
}
-
}
diff --git a/src/token/QuoteMark.java b/src/main/java/token/QuoteMark.java
similarity index 99%
rename from src/token/QuoteMark.java
rename to src/main/java/token/QuoteMark.java
index 8dba568..b3b706c 100644
--- a/src/token/QuoteMark.java
+++ b/src/main/java/token/QuoteMark.java
@@ -1,14 +1,14 @@
package token;
-import static sexpression.Nil.NIL;
-
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.Cons;
import sexpression.SExpression;
import sexpression.Symbol;
+import java.util.function.Supplier;
+
+import static sexpression.Nil.NIL;
+
public class QuoteMark extends Token {
public QuoteMark(String text, FilePosition position) {
@@ -22,5 +22,4 @@ public class QuoteMark extends Token {
return new Cons(Symbol.createQuote(), new Cons(argument, NIL));
}
-
}
diff --git a/src/token/QuotedString.java b/src/main/java/token/QuotedString.java
similarity index 99%
rename from src/token/QuotedString.java
rename to src/main/java/token/QuotedString.java
index 22b08b9..153f5dd 100644
--- a/src/token/QuotedString.java
+++ b/src/main/java/token/QuotedString.java
@@ -1,11 +1,11 @@
package token;
-import java.util.function.Supplier;
-
import file.FilePosition;
import sexpression.LispString;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
public class QuotedString extends Token {
public QuotedString(String text, FilePosition position) {
@@ -16,5 +16,4 @@ public class QuotedString extends Token {
public SExpression parseSExpression(Supplier getNextToken) {
return new LispString(getText());
}
-
}
diff --git a/src/token/RightParenthesis.java b/src/main/java/token/RightParenthesis.java
similarity index 99%
rename from src/token/RightParenthesis.java
rename to src/main/java/token/RightParenthesis.java
index e76b9d6..f702288 100644
--- a/src/token/RightParenthesis.java
+++ b/src/main/java/token/RightParenthesis.java
@@ -1,16 +1,16 @@
package token;
-import static recursion.TailCalls.done;
-import static sexpression.Nil.NIL;
-
-import java.util.function.Supplier;
-
import error.LineColumnException;
import file.FilePosition;
import recursion.TailCall;
import sexpression.Cons;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
+import static recursion.TailCalls.done;
+import static sexpression.Nil.NIL;
+
public class RightParenthesis extends Token {
public RightParenthesis(String text, FilePosition position) {
@@ -45,5 +45,4 @@ public class RightParenthesis extends Token {
return "expression begins with ')'";
}
}
-
}
diff --git a/src/token/Token.java b/src/main/java/token/Token.java
similarity index 99%
rename from src/token/Token.java
rename to src/main/java/token/Token.java
index 14e479f..ba316ef 100644
--- a/src/token/Token.java
+++ b/src/main/java/token/Token.java
@@ -1,15 +1,15 @@
package token;
-import static recursion.TailCalls.tailCall;
-import static sexpression.Nil.NIL;
-
-import java.util.function.Supplier;
-
import file.FilePosition;
import recursion.TailCall;
import sexpression.Cons;
import sexpression.SExpression;
+import java.util.function.Supplier;
+
+import static recursion.TailCalls.tailCall;
+import static sexpression.Nil.NIL;
+
public abstract class Token {
private String text;
@@ -52,5 +52,4 @@ public abstract class Token {
return tailCall(() -> next.parseListTailRecursive(start, newEnd, getNextToken));
}
-
}
diff --git a/src/token/TokenFactory.java b/src/main/java/token/TokenFactory.java
similarity index 99%
rename from src/token/TokenFactory.java
rename to src/main/java/token/TokenFactory.java
index d35aa89..5910b52 100644
--- a/src/token/TokenFactory.java
+++ b/src/main/java/token/TokenFactory.java
@@ -1,11 +1,11 @@
package token;
-import static java.text.MessageFormat.format;
-
import error.CriticalLineColumnException;
import error.LineColumnException;
import file.FilePosition;
+import static java.text.MessageFormat.format;
+
public interface TokenFactory {
Token createToken(String text, FilePosition position);
@@ -41,5 +41,4 @@ public interface TokenFactory {
return format("illegal character >>{0}<<", text);
}
}
-
}
diff --git a/src/token/TokenFactoryImpl.java b/src/main/java/token/TokenFactoryImpl.java
similarity index 62%
rename from src/token/TokenFactoryImpl.java
rename to src/main/java/token/TokenFactoryImpl.java
index 706df21..93a47ea 100644
--- a/src/token/TokenFactoryImpl.java
+++ b/src/main/java/token/TokenFactoryImpl.java
@@ -1,5 +1,7 @@
package token;
+import file.FilePosition;
+
import static java.lang.Character.isDigit;
import static util.Characters.AT_SIGN;
import static util.Characters.BACKQUOTE;
@@ -11,8 +13,6 @@ import static util.Characters.SINGLE_QUOTE;
import static util.Characters.isLegalIdentifierCharacter;
import static util.Characters.isNumberPrefix;
-import file.FilePosition;
-
public class TokenFactoryImpl implements TokenFactory {
@Override
@@ -23,25 +23,25 @@ public class TokenFactoryImpl implements TokenFactory {
char firstCharacter = text.charAt(0);
switch (firstCharacter) {
- case LEFT_PARENTHESIS:
- return new LeftParenthesis(text, position);
- case RIGHT_PARENTHESIS:
- return new RightParenthesis(text, position);
- case SINGLE_QUOTE:
- return new QuoteMark(text, position);
- case DOUBLE_QUOTE:
- return new QuotedString(text, position);
- case BACKQUOTE:
- return new Backquote(text, position);
- case AT_SIGN:
- return new AtSign(text, position);
- case COMMA:
- return new Comma(text, position);
- default:
- if (isNumeric(firstCharacter, text))
- return new Number(text, position);
- else if (isLegalIdentifierCharacter(firstCharacter))
- return new Identifier(text, position);
+ case LEFT_PARENTHESIS:
+ return new LeftParenthesis(text, position);
+ case RIGHT_PARENTHESIS:
+ return new RightParenthesis(text, position);
+ case SINGLE_QUOTE:
+ return new QuoteMark(text, position);
+ case DOUBLE_QUOTE:
+ return new QuotedString(text, position);
+ case BACKQUOTE:
+ return new Backquote(text, position);
+ case AT_SIGN:
+ return new AtSign(text, position);
+ case COMMA:
+ return new Comma(text, position);
+ default:
+ if (isNumeric(firstCharacter, text))
+ return new Number(text, position);
+ else if (isLegalIdentifierCharacter(firstCharacter))
+ return new Identifier(text, position);
}
throw new BadCharacterException(text, position);
@@ -63,5 +63,4 @@ public class TokenFactoryImpl implements TokenFactory {
public Token createEofToken(FilePosition position) {
return new Eof("EOF", position);
}
-
}
diff --git a/src/util/Characters.java b/src/main/java/util/Characters.java
similarity index 99%
rename from src/util/Characters.java
rename to src/main/java/util/Characters.java
index 8211812..7a3a2e9 100644
--- a/src/util/Characters.java
+++ b/src/main/java/util/Characters.java
@@ -57,5 +57,4 @@ public final class Characters {
public static boolean isNumberPrefix(char c) {
return c == DASH || c == PLUS;
}
-
}
diff --git a/src/util/Path.java b/src/main/java/util/Path.java
similarity index 99%
rename from src/util/Path.java
rename to src/main/java/util/Path.java
index 4cd97db..c845e8e 100644
--- a/src/util/Path.java
+++ b/src/main/java/util/Path.java
@@ -9,5 +9,4 @@ public final class Path {
public static String getPathPrefix(String fileName) {
return fileName.substring(0, fileName.lastIndexOf(File.separator) + 1);
}
-
}
diff --git a/lisp/lang/dlambda.lisp b/src/main/resources/dlambda.lisp
similarity index 100%
rename from lisp/lang/dlambda.lisp
rename to src/main/resources/dlambda.lisp
diff --git a/lisp/lang/functions.lisp b/src/main/resources/functions.lisp
similarity index 100%
rename from lisp/lang/functions.lisp
rename to src/main/resources/functions.lisp
diff --git a/test/acceptance/AcceptanceTest.java b/src/test/java/acceptance/AcceptanceTest.java
similarity index 99%
rename from test/acceptance/AcceptanceTest.java
rename to src/test/java/acceptance/AcceptanceTest.java
index 52abf41..854d208 100644
--- a/test/acceptance/AcceptanceTest.java
+++ b/src/test/java/acceptance/AcceptanceTest.java
@@ -1,8 +1,7 @@
package acceptance;
-import org.junit.runner.RunWith;
-
import fitnesse.junit.FitNesseRunner;
+import org.junit.runner.RunWith;
@RunWith(FitNesseRunner.class)
@FitNesseRunner.Suite("TranscendentalLisp")
diff --git a/test/acceptance/fixture/LispInterpreterFixture.java b/src/test/java/acceptance/fixture/LispInterpreterFixture.java
similarity index 97%
rename from test/acceptance/fixture/LispInterpreterFixture.java
rename to src/test/java/acceptance/fixture/LispInterpreterFixture.java
index c476c5a..5c2597d 100644
--- a/test/acceptance/fixture/LispInterpreterFixture.java
+++ b/src/test/java/acceptance/fixture/LispInterpreterFixture.java
@@ -1,8 +1,10 @@
package acceptance.fixture;
-import static main.LispMain.LANGUAGE_FILE_NAMES;
-import static table.FunctionTable.resetFunctionTable;
-import static util.Path.getPathPrefix;
+import environment.RuntimeEnvironment;
+import interpreter.LispInterpreter;
+import interpreter.LispInterpreterBuilder;
+import interpreter.LispInterpreterBuilderImpl;
+import table.ExecutionContext;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -10,11 +12,9 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
-import environment.RuntimeEnvironment;
-import interpreter.LispInterpreter;
-import interpreter.LispInterpreterBuilder;
-import interpreter.LispInterpreterBuilderImpl;
-import table.ExecutionContext;
+import static application.LispMain.LANGUAGE_FILE_NAMES;
+import static table.FunctionTable.resetFunctionTable;
+import static util.Path.getPathPrefix;
public class LispInterpreterFixture {
@@ -75,5 +75,4 @@ public class LispInterpreterFixture {
return output.trim();
}
-
}
diff --git a/test/main/MainTest.java b/src/test/java/application/MainTest.java
similarity index 88%
rename from test/main/MainTest.java
rename to src/test/java/application/MainTest.java
index 8c89602..49a9770 100644
--- a/test/main/MainTest.java
+++ b/src/test/java/application/MainTest.java
@@ -1,33 +1,33 @@
-package main;
-
-import static com.googlecode.lanterna.input.KeyType.Enter;
-import static java.text.MessageFormat.format;
-import static main.LispMain.ANSI_GREEN;
-import static main.LispMain.ANSI_PURPLE;
-import static main.LispMain.ANSI_RESET;
-import static main.LispMain.GREETING;
-import static org.junit.Assert.assertEquals;
-
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.concurrent.CountDownLatch;
+package application;
+import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal;
+import environment.RuntimeEnvironment;
+import interpreter.LispInterpreterBuilderImpl;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import org.junit.contrib.java.lang.system.SystemErrRule;
import org.junit.contrib.java.lang.system.SystemOutRule;
-
-import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal;
-
-import environment.RuntimeEnvironment;
-import interpreter.LispInterpreterBuilderImpl;
import terminal.TerminalConfiguration;
import terminal.VirtualTerminalInteractor;
import testutil.SymbolAndFunctionCleaner;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.concurrent.CountDownLatch;
+
+import static application.LispMain.ANSI_GREEN;
+import static application.LispMain.ANSI_PURPLE;
+import static application.LispMain.ANSI_RESET;
+import static application.LispMain.GREETING;
+import static com.googlecode.lanterna.input.KeyType.Enter;
+import static java.text.MessageFormat.format;
+import static org.junit.Assert.assertEquals;
+
public class MainTest extends SymbolAndFunctionCleaner {
+ private static final String FILE = MainTest.class.getResource("file.lisp").getFile();
+
private RuntimeEnvironment environment;
private CountDownLatch latch;
@@ -64,7 +64,8 @@ public class MainTest extends SymbolAndFunctionCleaner {
private void waitForInterpreterToShutdown() {
try {
latch.await();
- } catch (InterruptedException ignored) {}
+ } catch (InterruptedException ignored) {
+ }
}
private String getSystemOutLog() {
@@ -100,21 +101,20 @@ public class MainTest extends SymbolAndFunctionCleaner {
@Test
public void runWithBadFile() {
- String expectedMessage = "[critical] test/main/test-files/bad.lisp (No such file or directory)";
+ String expectedMessage = "[critical] bad.lisp (No such file or directory)";
exit.expectSystemExitWithStatus(1);
exit.checkAssertionAfterwards(() -> {
assertEquals(format("{0}{1}{2}\n", ANSI_PURPLE, expectedMessage, ANSI_RESET), getSystemErrLog());
assertEquals("", getSystemOutLog());
-
});
- runInterpreterWithFile("test/main/test-files/bad.lisp");
+ runInterpreterWithFile("bad.lisp");
}
@Test
public void runWithFile_PrintsDecoratedLastValueOnly() {
- runInterpreterWithFile("test/main/test-files/file.lisp");
+ runInterpreterWithFile(FILE);
assertEquals("", getSystemErrLog());
assertEquals(format("{0}{1}{2}\n\n", ANSI_GREEN, "RADISH", ANSI_RESET), getSystemOutLog());
@@ -138,10 +138,9 @@ public class MainTest extends SymbolAndFunctionCleaner {
@Test
public void runMain() {
- LispMain.main(new String[] { "test/main/test-files/file.lisp" });
+ LispMain.main(new String[] { FILE });
assertEquals("", getSystemErrLog());
assertEquals(format("{0}{1}{2}\n\n", ANSI_GREEN, "RADISH", ANSI_RESET), getSystemOutLog());
}
-
}
diff --git a/test/environment/RuntimeEnvironmentTest.java b/src/test/java/environment/RuntimeEnvironmentTest.java
similarity index 93%
rename from test/environment/RuntimeEnvironmentTest.java
rename to src/test/java/environment/RuntimeEnvironmentTest.java
index a18820a..22675af 100644
--- a/test/environment/RuntimeEnvironmentTest.java
+++ b/src/test/java/environment/RuntimeEnvironmentTest.java
@@ -1,19 +1,18 @@
package environment;
+import error.ErrorManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import error.ErrorManager;
-
public class RuntimeEnvironmentTest {
private static final String TERMINATED_SUCCESSFULLY = "TERMINATED_SUCCESSFULLY";
@@ -158,37 +157,43 @@ public class RuntimeEnvironmentTest {
try {
environment.terminateSuccessfully();
fail("terminateSuccessfully");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
environment.terminateExceptionally();
fail("terminateExceptionally");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
environment.decoratePrompt("");
fail("decoratePrompt");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
environment.decorateValueOutput("");
fail("decorateValueOutput");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
environment.decorateWarningOutput("");
fail("decorateWarningOutput");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
environment.decorateErrorOutput("");
fail("decorateErrorOutput");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
environment.decorateCriticalOutput("");
fail("decorateCriticalOutput");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
}
-
}
diff --git a/test/error/ErrorManagerTest.java b/src/test/java/error/ErrorManagerTest.java
similarity index 96%
rename from test/error/ErrorManagerTest.java
rename to src/test/java/error/ErrorManagerTest.java
index d04f4c6..fbc0fd3 100644
--- a/test/error/ErrorManagerTest.java
+++ b/src/test/java/error/ErrorManagerTest.java
@@ -1,22 +1,20 @@
package error;
-import static error.ErrorManager.Severity.CRITICAL;
-import static error.ErrorManager.Severity.ERROR;
-import static error.ErrorManager.Severity.WARNING;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import environment.RuntimeEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import environment.RuntimeEnvironment;
-import error.ErrorManager.Severity;
+import static error.Severity.CRITICAL;
+import static error.Severity.ERROR;
+import static error.Severity.WARNING;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class ErrorManagerTest {
@@ -163,5 +161,4 @@ public class ErrorManagerTest {
for (Severity severity : Severity.values())
Severity.valueOf(severity.toString());
}
-
}
diff --git a/test/file/FilePositionTrackerTest.java b/src/test/java/file/FilePositionTrackerTest.java
similarity index 99%
rename from test/file/FilePositionTrackerTest.java
rename to src/test/java/file/FilePositionTrackerTest.java
index b62ddf3..882705f 100644
--- a/test/file/FilePositionTrackerTest.java
+++ b/src/test/java/file/FilePositionTrackerTest.java
@@ -1,12 +1,12 @@
package file;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Objects;
-
import org.junit.Before;
import org.junit.Test;
+import java.util.Objects;
+
+import static org.junit.Assert.assertTrue;
+
public class FilePositionTrackerTest {
public static final String FILE_NAME = "testFile";
@@ -62,5 +62,4 @@ public class FilePositionTrackerTest {
assertTrackerPositionEquals(createFilePosition(2, 0));
}
-
}
diff --git a/test/function/ArgumentValidatorTest.java b/src/test/java/function/ArgumentValidatorTest.java
similarity index 99%
rename from test/function/ArgumentValidatorTest.java
rename to src/test/java/function/ArgumentValidatorTest.java
index 6900fd2..c3ded9d 100644
--- a/test/function/ArgumentValidatorTest.java
+++ b/src/test/java/function/ArgumentValidatorTest.java
@@ -1,25 +1,24 @@
package function;
-import static error.ErrorManager.Severity.ERROR;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
-import org.junit.Before;
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Before;
+import org.junit.Test;
import sexpression.Cons;
import sexpression.LispString;
import sexpression.Nil;
import sexpression.SExpression;
import sexpression.Symbol;
+import static error.Severity.ERROR;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+
public class ArgumentValidatorTest {
private ArgumentValidator validator;
@@ -222,5 +221,4 @@ public class ArgumentValidatorTest {
validator.setEveryArgumentExcludedType(Nil.class);
validator.validate(new Cons(T, new Cons(NIL, NIL)));
}
-
}
diff --git a/test/function/LispFunctionTest.java b/src/test/java/function/LispFunctionTest.java
similarity index 99%
rename from test/function/LispFunctionTest.java
rename to src/test/java/function/LispFunctionTest.java
index 7bb4760..7ca00c0 100644
--- a/test/function/LispFunctionTest.java
+++ b/src/test/java/function/LispFunctionTest.java
@@ -1,12 +1,11 @@
package function;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Test;
-
import sexpression.Cons;
import sexpression.SExpression;
+import static org.junit.Assert.assertTrue;
+
public class LispFunctionTest {
@Test
@@ -21,5 +20,4 @@ public class LispFunctionTest {
assertTrue(lispFunction.isArgumentListEvaluated());
}
-
}
diff --git a/test/function/LispSpecialFunctionTest.java b/src/test/java/function/LispSpecialFunctionTest.java
similarity index 99%
rename from test/function/LispSpecialFunctionTest.java
rename to src/test/java/function/LispSpecialFunctionTest.java
index 87c1b6a..4e064bd 100644
--- a/test/function/LispSpecialFunctionTest.java
+++ b/src/test/java/function/LispSpecialFunctionTest.java
@@ -1,12 +1,11 @@
package function;
-import static org.junit.Assert.assertFalse;
-
import org.junit.Test;
-
import sexpression.Cons;
import sexpression.SExpression;
+import static org.junit.Assert.assertFalse;
+
public class LispSpecialFunctionTest {
@Test
@@ -21,5 +20,4 @@ public class LispSpecialFunctionTest {
assertFalse(lispFunction.isArgumentListEvaluated());
}
-
}
diff --git a/test/function/UserDefinedFunctionTest.java b/src/test/java/function/UserDefinedFunctionTest.java
similarity index 96%
rename from test/function/UserDefinedFunctionTest.java
rename to src/test/java/function/UserDefinedFunctionTest.java
index 1ec8d3c..cb3334b 100644
--- a/test/function/UserDefinedFunctionTest.java
+++ b/src/test/java/function/UserDefinedFunctionTest.java
@@ -1,22 +1,21 @@
package function;
+import error.Severity;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import function.UserDefinedFunction.IllegalKeywordRestPositionException;
+import org.junit.Test;
+import sexpression.Cons;
+import sexpression.LispNumber;
+import sexpression.SExpression;
+import sexpression.Symbol;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static sexpression.Nil.NIL;
import static testutil.TestUtilities.assertSExpressionsMatch;
-import org.junit.Test;
-
-import error.ErrorManager;
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import function.UserDefinedFunction.IllegalKeywordRestPositionException;
-import sexpression.Cons;
-import sexpression.LispNumber;
-import sexpression.SExpression;
-import sexpression.Symbol;
-
public class UserDefinedFunctionTest {
private static final String FUNCTION_NAME = "TEST";
@@ -75,7 +74,6 @@ public class UserDefinedFunctionTest {
assertNotNull(e.getMessage());
assertTrue(e.getMessage().length() > 0);
- assertEquals(ErrorManager.Severity.ERROR, e.getSeverity());
+ assertEquals(Severity.ERROR, e.getSeverity());
}
-
}
diff --git a/test/function/builtin/APPLYTest.java b/src/test/java/function/builtin/APPLYTest.java
similarity index 99%
rename from test/function/builtin/APPLYTest.java
rename to src/test/java/function/builtin/APPLYTest.java
index b3e5746..2087c00 100644
--- a/test/function/builtin/APPLYTest.java
+++ b/src/test/java/function/builtin/APPLYTest.java
@@ -1,20 +1,19 @@
package function.builtin;
-import static function.builtin.APPLY.apply;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.EVAL.UndefinedFunctionException;
+import org.junit.Test;
import sexpression.Cons;
import testutil.SymbolAndFunctionCleaner;
+import static function.builtin.APPLY.apply;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class APPLYTest extends SymbolAndFunctionCleaner {
@Test
diff --git a/test/function/builtin/BackquoteEvaluatorTest.java b/src/test/java/function/builtin/BackquoteEvaluatorTest.java
similarity index 95%
rename from test/function/builtin/BackquoteEvaluatorTest.java
rename to src/test/java/function/builtin/BackquoteEvaluatorTest.java
index 88a3241..1be36b2 100644
--- a/test/function/builtin/BackquoteEvaluatorTest.java
+++ b/src/test/java/function/builtin/BackquoteEvaluatorTest.java
@@ -1,18 +1,11 @@
package function.builtin;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-import static testutil.TestUtilities.assertIsErrorWithMessage;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.makeList;
-
-import org.junit.Test;
-
import function.ArgumentValidator.DottedArgumentListException;
import function.builtin.BackquoteEvaluator.AtSignNotInCommaException;
import function.builtin.BackquoteEvaluator.AtSignNotListException;
import function.builtin.BackquoteEvaluator.NestedAtSignException;
import function.builtin.BackquoteEvaluator.NestedCommaException;
+import org.junit.Test;
import sexpression.AtSignExpression;
import sexpression.BackquoteExpression;
import sexpression.CommaExpression;
@@ -22,6 +15,12 @@ import sexpression.LispString;
import sexpression.SExpression;
import sexpression.Symbol;
+import static sexpression.Nil.NIL;
+import static sexpression.Symbol.T;
+import static testutil.TestUtilities.assertIsErrorWithMessage;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.makeList;
+
public class BackquoteEvaluatorTest {
private BackquoteEvaluator createBackquoteEvaluator(SExpression expression) {
@@ -95,7 +94,8 @@ public class BackquoteEvaluatorTest {
@Test(expected = NestedAtSignException.class)
public void evaluateListWithNestedAtSigns() {
- SExpression input = makeList(new CommaExpression(new AtSignExpression(new AtSignExpression(makeList(new Symbol("+"))))));
+ SExpression input =
+ makeList(new CommaExpression(new AtSignExpression(new AtSignExpression(makeList(new Symbol("+"))))));
BackquoteEvaluator evaluator = createBackquoteEvaluator(input);
evaluator.evaluate();
@@ -103,7 +103,8 @@ public class BackquoteEvaluatorTest {
@Test(expected = NestedCommaException.class)
public void evaluateListWithCommaAfterAtSign() {
- SExpression input = makeList(new CommaExpression(new AtSignExpression(new CommaExpression(makeList(new Symbol("+"))))));
+ SExpression input =
+ makeList(new CommaExpression(new AtSignExpression(new CommaExpression(makeList(new Symbol("+"))))));
BackquoteEvaluator evaluator = createBackquoteEvaluator(input);
evaluator.evaluate();
@@ -174,5 +175,4 @@ public class BackquoteEvaluatorTest {
assertIsErrorWithMessage(new AtSignNotInCommaException());
assertIsErrorWithMessage(new AtSignNotListException());
}
-
}
diff --git a/test/function/builtin/EVALTest.java b/src/test/java/function/builtin/EVALTest.java
similarity index 95%
rename from test/function/builtin/EVALTest.java
rename to src/test/java/function/builtin/EVALTest.java
index ae0fe66..ca36fca 100644
--- a/test/function/builtin/EVALTest.java
+++ b/src/test/java/function/builtin/EVALTest.java
@@ -1,16 +1,5 @@
package function.builtin;
-import static function.builtin.EVAL.lookupSymbol;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import static sexpression.Nil.NIL;
-import static testutil.TestUtilities.assertIsErrorWithMessage;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
@@ -20,8 +9,18 @@ import function.builtin.EVAL.UndefinedSymbolException;
import function.builtin.EVAL.UnmatchedAtSignException;
import function.builtin.EVAL.UnmatchedCommaException;
import function.builtin.special.RECUR.RecurNotInTailPositionException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static function.builtin.EVAL.lookupSymbol;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static sexpression.Nil.NIL;
+import static testutil.TestUtilities.assertIsErrorWithMessage;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class EVALTest extends SymbolAndFunctionCleaner {
@Test
@@ -43,7 +42,6 @@ public class EVALTest extends SymbolAndFunctionCleaner {
String input = "(let ((x 1)) (eval '(+ x 1)))";
assertSExpressionsMatch(parseString("2"), evaluateString(input));
-
}
@Test
@@ -195,7 +193,8 @@ public class EVALTest extends SymbolAndFunctionCleaner {
try {
evaluateString("(let ((n 200)) (begin 1 2 3 y))");
fail("expected exception");
- } catch (UndefinedSymbolException e) {}
+ } catch (UndefinedSymbolException e) {
+ }
assertSExpressionsMatch(parseString("100"), evaluateString("n"));
}
@@ -208,7 +207,8 @@ public class EVALTest extends SymbolAndFunctionCleaner {
evaluateString("(defun test (n) (begin 1 2 3 y))");
evaluateString("(test 200)");
fail("expected exception");
- } catch (UndefinedSymbolException e) {}
+ } catch (UndefinedSymbolException e) {
+ }
assertSExpressionsMatch(parseString("100"), evaluateString("n"));
}
@@ -220,7 +220,8 @@ public class EVALTest extends SymbolAndFunctionCleaner {
try {
evaluateString("((lambda (n) (begin 1 2 3 y)) 200)");
fail("expected exception");
- } catch (UndefinedSymbolException e) {}
+ } catch (UndefinedSymbolException e) {
+ }
assertSExpressionsMatch(parseString("100"), evaluateString("n"));
}
@@ -233,7 +234,8 @@ public class EVALTest extends SymbolAndFunctionCleaner {
evaluateString("(defun tail-recursive (n) (begin (recur) 2))");
evaluateString("(tail-recursive 200)");
fail("expected exception");
- } catch (RecurNotInTailPositionException e) {}
+ } catch (RecurNotInTailPositionException e) {
+ }
assertSExpressionsMatch(parseString("100"), evaluateString("n"));
}
@@ -246,7 +248,8 @@ public class EVALTest extends SymbolAndFunctionCleaner {
evaluateString("(defun tail-recursive (n) (begin (recur) 2))");
evaluateString("(apply 'tail-recursive '(200))");
fail("expected exception");
- } catch (RecurNotInTailPositionException e) {}
+ } catch (RecurNotInTailPositionException e) {
+ }
assertSExpressionsMatch(parseString("100"), evaluateString("n"));
}
diff --git a/test/function/builtin/EXITTest.java b/src/test/java/function/builtin/EXITTest.java
similarity index 99%
rename from test/function/builtin/EXITTest.java
rename to src/test/java/function/builtin/EXITTest.java
index 491dfbd..c9a0965 100644
--- a/test/function/builtin/EXITTest.java
+++ b/src/test/java/function/builtin/EXITTest.java
@@ -1,17 +1,16 @@
package function.builtin;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.evaluateString;
+import environment.RuntimeEnvironment;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Test;
-
-import environment.RuntimeEnvironment;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.evaluateString;
public class EXITTest extends SymbolAndFunctionCleaner {
@@ -58,5 +57,4 @@ public class EXITTest extends SymbolAndFunctionCleaner {
public void exitWithTooManyArguments() {
evaluateString("(exit 1)");
}
-
}
diff --git a/test/function/builtin/FUNCALLTest.java b/src/test/java/function/builtin/FUNCALLTest.java
similarity index 99%
rename from test/function/builtin/FUNCALLTest.java
rename to src/test/java/function/builtin/FUNCALLTest.java
index be3c329..5d2d7b1 100644
--- a/test/function/builtin/FUNCALLTest.java
+++ b/src/test/java/function/builtin/FUNCALLTest.java
@@ -1,14 +1,13 @@
package function.builtin;
+import function.ArgumentValidator.TooFewArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class FUNCALLTest extends SymbolAndFunctionCleaner {
@Test
@@ -38,5 +37,4 @@ public class FUNCALLTest extends SymbolAndFunctionCleaner {
public void funcallWithTooFewArguments() {
evaluateString("(funcall)");
}
-
}
diff --git a/test/function/builtin/GENSYMTest.java b/src/test/java/function/builtin/GENSYMTest.java
similarity index 99%
rename from test/function/builtin/GENSYMTest.java
rename to src/test/java/function/builtin/GENSYMTest.java
index 780519e..5befff7 100644
--- a/test/function/builtin/GENSYMTest.java
+++ b/src/test/java/function/builtin/GENSYMTest.java
@@ -1,17 +1,16 @@
package function.builtin;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+import token.TokenFactory.BadCharacterException;
+
import static function.builtin.GENSYM.GENSYM_PREFIX;
import static testutil.TestUtilities.assertSExpressionsDoNotMatch;
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertSymbol;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-import token.TokenFactory.BadCharacterException;
-
public class GENSYMTest extends SymbolAndFunctionCleaner {
@Test
@@ -40,5 +39,4 @@ public class GENSYMTest extends SymbolAndFunctionCleaner {
public void gensymWithTooManyArguments() {
evaluateString("(gensym 1)");
}
-
}
diff --git a/test/function/builtin/LOADTest.java b/src/test/java/function/builtin/LOADTest.java
similarity index 85%
rename from test/function/builtin/LOADTest.java
rename to src/test/java/function/builtin/LOADTest.java
index 5b7bf31..ae67a2b 100644
--- a/test/function/builtin/LOADTest.java
+++ b/src/test/java/function/builtin/LOADTest.java
@@ -1,22 +1,21 @@
package function.builtin;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TypeAssertions.assertNil;
-import static testutil.TypeAssertions.assertT;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.Test;
-
import environment.RuntimeEnvironment;
import error.ErrorManager;
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TypeAssertions.assertNil;
+import static testutil.TypeAssertions.assertT;
+
public class LOADTest extends SymbolAndFunctionCleaner {
private ByteArrayOutputStream outputStream;
@@ -71,7 +70,8 @@ public class LOADTest extends SymbolAndFunctionCleaner {
@Test
public void loadGoodFile_ReturnsTAndPrintsNothing() {
- String input = "(load \"test/function/builtin/test-files/load-good.lisp\")";
+ String file = LOADTest.class.getResource("load-good.lisp").getFile();
+ String input = "(load \"" + file + "\")";
assertT(evaluateString(input));
assertNothingPrinted();
@@ -79,7 +79,8 @@ public class LOADTest extends SymbolAndFunctionCleaner {
@Test
public void loadBadFile_ReturnsNilAndPrintsError() {
- String input = "(load \"test/function/builtin/test-files/load-bad.lisp\")";
+ String file = LOADTest.class.getResource("load-bad.lisp").getFile();
+ String input = "(load \"" + file + "\")";
assertNil(evaluateString(input));
assertErrorMessagePrinted();
@@ -95,7 +96,8 @@ public class LOADTest extends SymbolAndFunctionCleaner {
@Test
public void nestedLoadsInTheSameDirectory() {
- String input = "(load \"test/function/builtin/test-files/nested/nested.lisp\")";
+ String file = LOADTest.class.getResource("nested/nested.lisp").getFile();
+ String input = "(load \"" + file + "\")";
assertT(evaluateString(input));
assertNothingPrinted();
@@ -103,7 +105,8 @@ public class LOADTest extends SymbolAndFunctionCleaner {
@Test
public void nestedLoadsInDifferentDirectories() {
- String input = "(load \"test/function/builtin/test-files/nested/one/load-one.lisp\")";
+ String file = LOADTest.class.getResource("nested/one/load-one.lisp").getFile();
+ String input = "(load \"" + file + "\")";
assertT(evaluateString(input));
assertNothingPrinted();
@@ -126,11 +129,10 @@ public class LOADTest extends SymbolAndFunctionCleaner {
@Test
public void loadUsesRuntimePath() {
- environment.setPath("test/function/builtin/test-files/nested/one/");
+ environment.setPath(LOADTest.class.getResource("nested/one/").getPath());
String input = "(load \"load-one.lisp\")";
assertT(evaluateString(input));
assertNothingPrinted();
}
-
}
diff --git a/test/function/builtin/PRINTTest.java b/src/test/java/function/builtin/PRINTTest.java
similarity index 99%
rename from test/function/builtin/PRINTTest.java
rename to src/test/java/function/builtin/PRINTTest.java
index 7f70925..4587939 100644
--- a/test/function/builtin/PRINTTest.java
+++ b/src/test/java/function/builtin/PRINTTest.java
@@ -1,19 +1,18 @@
package function.builtin;
-import static java.text.MessageFormat.format;
-import static org.junit.Assert.assertEquals;
-import static testutil.TestUtilities.evaluateString;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.Test;
-
import environment.RuntimeEnvironment;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import static java.text.MessageFormat.format;
+import static org.junit.Assert.assertEquals;
+import static testutil.TestUtilities.evaluateString;
+
public class PRINTTest extends SymbolAndFunctionCleaner {
private RuntimeEnvironment environment;
@@ -64,5 +63,4 @@ public class PRINTTest extends SymbolAndFunctionCleaner {
public void printWithTooFewArguments() {
evaluateString("(print)");
}
-
}
diff --git a/test/function/builtin/SETTest.java b/src/test/java/function/builtin/SETTest.java
similarity index 99%
rename from test/function/builtin/SETTest.java
rename to src/test/java/function/builtin/SETTest.java
index 9b31bf9..47fb866 100644
--- a/test/function/builtin/SETTest.java
+++ b/src/test/java/function/builtin/SETTest.java
@@ -1,19 +1,18 @@
package function.builtin;
-import static org.junit.Assert.assertNull;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
import sexpression.LispNumber;
import table.SymbolTable;
import testutil.SymbolAndFunctionCleaner;
+import static org.junit.Assert.assertNull;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class SETTest extends SymbolAndFunctionCleaner {
@Test
@@ -81,5 +80,4 @@ public class SETTest extends SymbolAndFunctionCleaner {
public void setWithTooManyArguments() {
evaluateString("(set 'a 'b 'c)");
}
-
}
diff --git a/test/function/builtin/SYMBOLSTest.java b/src/test/java/function/builtin/SYMBOLSTest.java
similarity index 99%
rename from test/function/builtin/SYMBOLSTest.java
rename to src/test/java/function/builtin/SYMBOLSTest.java
index 88d87c3..1c47a78 100644
--- a/test/function/builtin/SYMBOLSTest.java
+++ b/src/test/java/function/builtin/SYMBOLSTest.java
@@ -1,13 +1,12 @@
package function.builtin;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class SYMBOLSTest extends SymbolAndFunctionCleaner {
@Test
diff --git a/test/function/builtin/SYMBOL_FUNCTIONTest.java b/src/test/java/function/builtin/SYMBOL_FUNCTIONTest.java
similarity index 97%
rename from test/function/builtin/SYMBOL_FUNCTIONTest.java
rename to src/test/java/function/builtin/SYMBOL_FUNCTIONTest.java
index 2c85807..9aeb813 100644
--- a/test/function/builtin/SYMBOL_FUNCTIONTest.java
+++ b/src/test/java/function/builtin/SYMBOL_FUNCTIONTest.java
@@ -1,20 +1,19 @@
package function.builtin;
-import static error.ErrorManager.Severity.ERROR;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static sexpression.Nil.NIL;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.SYMBOL_FUNCTION.UndefinedSymbolFunctionException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static error.Severity.ERROR;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static sexpression.Nil.NIL;
+import static testutil.TestUtilities.evaluateString;
+
public class SYMBOL_FUNCTIONTest extends SymbolAndFunctionCleaner {
@Test
@@ -70,5 +69,4 @@ public class SYMBOL_FUNCTIONTest extends SymbolAndFunctionCleaner {
assertNotNull(e.getMessage());
assertTrue(e.getMessage().length() > 0);
}
-
}
diff --git a/test/function/builtin/cons/APPENDTest.java b/src/test/java/function/builtin/cons/APPENDTest.java
similarity index 99%
rename from test/function/builtin/cons/APPENDTest.java
rename to src/test/java/function/builtin/cons/APPENDTest.java
index 5ed6fa9..5378fec 100644
--- a/test/function/builtin/cons/APPENDTest.java
+++ b/src/test/java/function/builtin/cons/APPENDTest.java
@@ -1,17 +1,16 @@
package function.builtin.cons;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class APPENDTest extends SymbolAndFunctionCleaner {
@Test
diff --git a/test/function/builtin/cons/CONSTest.java b/src/test/java/function/builtin/cons/CONSTest.java
similarity index 99%
rename from test/function/builtin/cons/CONSTest.java
rename to src/test/java/function/builtin/cons/CONSTest.java
index 5ba1014..53a7b63 100644
--- a/test/function/builtin/cons/CONSTest.java
+++ b/src/test/java/function/builtin/cons/CONSTest.java
@@ -1,17 +1,16 @@
package function.builtin.cons;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import sexpression.Cons;
+import sexpression.Symbol;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import sexpression.Cons;
-import sexpression.Symbol;
-import testutil.SymbolAndFunctionCleaner;
-
public class CONSTest extends SymbolAndFunctionCleaner {
@Test
@@ -58,5 +57,4 @@ public class CONSTest extends SymbolAndFunctionCleaner {
public void consWithTooFewArguments() {
evaluateString("(cons 1)");
}
-
}
diff --git a/test/function/builtin/cons/FIRSTTest.java b/src/test/java/function/builtin/cons/FIRSTTest.java
similarity index 99%
rename from test/function/builtin/cons/FIRSTTest.java
rename to src/test/java/function/builtin/cons/FIRSTTest.java
index e85bf77..c509634 100644
--- a/test/function/builtin/cons/FIRSTTest.java
+++ b/src/test/java/function/builtin/cons/FIRSTTest.java
@@ -1,16 +1,15 @@
package function.builtin.cons;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class FIRSTTest extends SymbolAndFunctionCleaner {
@Test
@@ -55,5 +54,4 @@ public class FIRSTTest extends SymbolAndFunctionCleaner {
public void firstWithTooFewArguments() {
evaluateString("(first)");
}
-
}
diff --git a/test/function/builtin/cons/LENGTHTest.java b/src/test/java/function/builtin/cons/LENGTHTest.java
similarity index 99%
rename from test/function/builtin/cons/LENGTHTest.java
rename to src/test/java/function/builtin/cons/LENGTHTest.java
index f2acc3d..0668a38 100644
--- a/test/function/builtin/cons/LENGTHTest.java
+++ b/src/test/java/function/builtin/cons/LENGTHTest.java
@@ -1,17 +1,16 @@
package function.builtin.cons;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class LENGTHTest extends SymbolAndFunctionCleaner {
@Test
@@ -54,5 +53,4 @@ public class LENGTHTest extends SymbolAndFunctionCleaner {
public void lengthWithDottedList() {
evaluateString("(length (cons 1 2))");
}
-
}
diff --git a/test/function/builtin/cons/LISTTest.java b/src/test/java/function/builtin/cons/LISTTest.java
similarity index 99%
rename from test/function/builtin/cons/LISTTest.java
rename to src/test/java/function/builtin/cons/LISTTest.java
index 84c1de3..b869eee 100644
--- a/test/function/builtin/cons/LISTTest.java
+++ b/src/test/java/function/builtin/cons/LISTTest.java
@@ -1,14 +1,13 @@
package function.builtin.cons;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static function.builtin.cons.LIST.makeList;
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import testutil.SymbolAndFunctionCleaner;
-
public class LISTTest extends SymbolAndFunctionCleaner {
@Test
@@ -57,5 +56,4 @@ public class LISTTest extends SymbolAndFunctionCleaner {
public void staticMakeList() {
assertSExpressionsMatch(parseString("(22)"), makeList(parseString("22")));
}
-
}
diff --git a/test/function/builtin/cons/RESTTest.java b/src/test/java/function/builtin/cons/RESTTest.java
similarity index 99%
rename from test/function/builtin/cons/RESTTest.java
rename to src/test/java/function/builtin/cons/RESTTest.java
index ffe983c..46c70d6 100644
--- a/test/function/builtin/cons/RESTTest.java
+++ b/src/test/java/function/builtin/cons/RESTTest.java
@@ -1,16 +1,15 @@
package function.builtin.cons;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class RESTTest extends SymbolAndFunctionCleaner {
@Test
@@ -55,5 +54,4 @@ public class RESTTest extends SymbolAndFunctionCleaner {
public void restWithTooFewArguments() {
evaluateString("(rest)");
}
-
}
diff --git a/test/function/builtin/math/DIVIDETest.java b/src/test/java/function/builtin/math/DIVIDETest.java
similarity index 99%
rename from test/function/builtin/math/DIVIDETest.java
rename to src/test/java/function/builtin/math/DIVIDETest.java
index 92208e1..f27409a 100644
--- a/test/function/builtin/math/DIVIDETest.java
+++ b/src/test/java/function/builtin/math/DIVIDETest.java
@@ -1,17 +1,16 @@
package function.builtin.math;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.builtin.math.DIVIDE.DivideByZeroException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertIsErrorWithMessage;
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.builtin.math.DIVIDE.DivideByZeroException;
-import testutil.SymbolAndFunctionCleaner;
-
public class DIVIDETest extends SymbolAndFunctionCleaner {
@Test
@@ -75,5 +74,4 @@ public class DIVIDETest extends SymbolAndFunctionCleaner {
public void divideByZeroException_HasCorrectAttributes() {
assertIsErrorWithMessage(new DivideByZeroException());
}
-
}
diff --git a/test/function/builtin/math/MINUSTest.java b/src/test/java/function/builtin/math/MINUSTest.java
similarity index 99%
rename from test/function/builtin/math/MINUSTest.java
rename to src/test/java/function/builtin/math/MINUSTest.java
index 8b8802b..6c350e1 100644
--- a/test/function/builtin/math/MINUSTest.java
+++ b/src/test/java/function/builtin/math/MINUSTest.java
@@ -1,15 +1,14 @@
package function.builtin.math;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
+import org.junit.Test;
import sexpression.LispNumber;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class MINUSTest extends SymbolAndFunctionCleaner {
@Test
@@ -49,5 +48,4 @@ public class MINUSTest extends SymbolAndFunctionCleaner {
public void minusWithTooFewArguments() {
evaluateString("(-)");
}
-
}
diff --git a/test/function/builtin/math/MODULOTest.java b/src/test/java/function/builtin/math/MODULOTest.java
similarity index 99%
rename from test/function/builtin/math/MODULOTest.java
rename to src/test/java/function/builtin/math/MODULOTest.java
index 93f2403..83f4df7 100644
--- a/test/function/builtin/math/MODULOTest.java
+++ b/src/test/java/function/builtin/math/MODULOTest.java
@@ -1,18 +1,17 @@
package function.builtin.math;
-import static testutil.TestUtilities.assertIsErrorWithMessage;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.math.MODULO.ModulusNotPositiveException;
+import org.junit.Test;
import sexpression.LispNumber;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertIsErrorWithMessage;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class MODULOTest extends SymbolAndFunctionCleaner {
@Test
diff --git a/test/function/builtin/math/MULTIPLYTest.java b/src/test/java/function/builtin/math/MULTIPLYTest.java
similarity index 99%
rename from test/function/builtin/math/MULTIPLYTest.java
rename to src/test/java/function/builtin/math/MULTIPLYTest.java
index 2a92dd6..d6cd2c9 100644
--- a/test/function/builtin/math/MULTIPLYTest.java
+++ b/src/test/java/function/builtin/math/MULTIPLYTest.java
@@ -1,14 +1,13 @@
package function.builtin.math;
+import function.ArgumentValidator.BadArgumentTypeException;
+import org.junit.Test;
+import sexpression.LispNumber;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import sexpression.LispNumber;
-import testutil.SymbolAndFunctionCleaner;
-
public class MULTIPLYTest extends SymbolAndFunctionCleaner {
@Test
@@ -50,5 +49,4 @@ public class MULTIPLYTest extends SymbolAndFunctionCleaner {
public void multiplyWithNonNumber() {
evaluateString("(* 'a 'b)");
}
-
}
diff --git a/test/function/builtin/math/PLUSTest.java b/src/test/java/function/builtin/math/PLUSTest.java
similarity index 99%
rename from test/function/builtin/math/PLUSTest.java
rename to src/test/java/function/builtin/math/PLUSTest.java
index 33f56a7..9e297dc 100644
--- a/test/function/builtin/math/PLUSTest.java
+++ b/src/test/java/function/builtin/math/PLUSTest.java
@@ -1,14 +1,13 @@
package function.builtin.math;
+import function.ArgumentValidator.BadArgumentTypeException;
+import org.junit.Test;
+import sexpression.LispNumber;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import sexpression.LispNumber;
-import testutil.SymbolAndFunctionCleaner;
-
public class PLUSTest extends SymbolAndFunctionCleaner {
@Test
@@ -50,5 +49,4 @@ public class PLUSTest extends SymbolAndFunctionCleaner {
public void plusWithNonNumber() {
evaluateString("(+ 'a 'b)");
}
-
}
diff --git a/test/function/builtin/math/REMAINDERTest.java b/src/test/java/function/builtin/math/REMAINDERTest.java
similarity index 99%
rename from test/function/builtin/math/REMAINDERTest.java
rename to src/test/java/function/builtin/math/REMAINDERTest.java
index d5096ab..0573267 100644
--- a/test/function/builtin/math/REMAINDERTest.java
+++ b/src/test/java/function/builtin/math/REMAINDERTest.java
@@ -1,17 +1,16 @@
package function.builtin.math;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.math.DIVIDE.DivideByZeroException;
+import org.junit.Test;
import sexpression.LispNumber;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class REMAINDERTest extends SymbolAndFunctionCleaner {
@Test
diff --git a/test/function/builtin/predicate/ATOMTest.java b/src/test/java/function/builtin/predicate/ATOMTest.java
similarity index 99%
rename from test/function/builtin/predicate/ATOMTest.java
rename to src/test/java/function/builtin/predicate/ATOMTest.java
index efd33b5..89dd78c 100644
--- a/test/function/builtin/predicate/ATOMTest.java
+++ b/src/test/java/function/builtin/predicate/ATOMTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class ATOMTest extends SymbolAndFunctionCleaner {
@Test
@@ -36,5 +35,4 @@ public class ATOMTest extends SymbolAndFunctionCleaner {
public void testApplyWithTooFewArguments() {
evaluateString("(atom)");
}
-
}
diff --git a/test/function/builtin/predicate/EQTest.java b/src/test/java/function/builtin/predicate/EQTest.java
similarity index 99%
rename from test/function/builtin/predicate/EQTest.java
rename to src/test/java/function/builtin/predicate/EQTest.java
index 7ff7b3b..32eca6e 100644
--- a/test/function/builtin/predicate/EQTest.java
+++ b/src/test/java/function/builtin/predicate/EQTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class EQTest extends SymbolAndFunctionCleaner {
@Test
@@ -110,5 +109,4 @@ public class EQTest extends SymbolAndFunctionCleaner {
public void eqWithTooFewArguments() {
evaluateString("(eq 'one)");
}
-
}
diff --git a/test/function/builtin/predicate/EQUALTest.java b/src/test/java/function/builtin/predicate/EQUALTest.java
similarity index 99%
rename from test/function/builtin/predicate/EQUALTest.java
rename to src/test/java/function/builtin/predicate/EQUALTest.java
index 0190836..59a71e6 100644
--- a/test/function/builtin/predicate/EQUALTest.java
+++ b/src/test/java/function/builtin/predicate/EQUALTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class EQUALTest extends SymbolAndFunctionCleaner {
@Test
@@ -112,5 +111,4 @@ public class EQUALTest extends SymbolAndFunctionCleaner {
public void equalWithTooFewArguments() {
evaluateString("(equal 1)");
}
-
}
diff --git a/test/function/builtin/predicate/GENSYM_EQUALTest.java b/src/test/java/function/builtin/predicate/GENSYM_EQUALTest.java
similarity index 99%
rename from test/function/builtin/predicate/GENSYM_EQUALTest.java
rename to src/test/java/function/builtin/predicate/GENSYM_EQUALTest.java
index 623b07a..154d201 100644
--- a/test/function/builtin/predicate/GENSYM_EQUALTest.java
+++ b/src/test/java/function/builtin/predicate/GENSYM_EQUALTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class GENSYM_EQUALTest extends SymbolAndFunctionCleaner {
@Test
@@ -158,5 +157,4 @@ public class GENSYM_EQUALTest extends SymbolAndFunctionCleaner {
assertNil(evaluateString(input));
}
-
}
diff --git a/test/function/builtin/predicate/LISTPTest.java b/src/test/java/function/builtin/predicate/LISTPTest.java
similarity index 99%
rename from test/function/builtin/predicate/LISTPTest.java
rename to src/test/java/function/builtin/predicate/LISTPTest.java
index f7dc56e..16a5f25 100644
--- a/test/function/builtin/predicate/LISTPTest.java
+++ b/src/test/java/function/builtin/predicate/LISTPTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class LISTPTest extends SymbolAndFunctionCleaner {
@Test
@@ -36,5 +35,4 @@ public class LISTPTest extends SymbolAndFunctionCleaner {
public void listpWithTooManyArguments() {
evaluateString("(listp '() '())");
}
-
}
diff --git a/test/function/builtin/predicate/NULLTest.java b/src/test/java/function/builtin/predicate/NULLTest.java
similarity index 99%
rename from test/function/builtin/predicate/NULLTest.java
rename to src/test/java/function/builtin/predicate/NULLTest.java
index 128394e..913dc18 100644
--- a/test/function/builtin/predicate/NULLTest.java
+++ b/src/test/java/function/builtin/predicate/NULLTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class NULLTest extends SymbolAndFunctionCleaner {
@Test
@@ -36,5 +35,4 @@ public class NULLTest extends SymbolAndFunctionCleaner {
public void testNullWithTooManyArguments() {
evaluateString("(null 1 2)");
}
-
}
diff --git a/test/function/builtin/predicate/NUMERIC_EQUALTest.java b/src/test/java/function/builtin/predicate/NUMERIC_EQUALTest.java
similarity index 99%
rename from test/function/builtin/predicate/NUMERIC_EQUALTest.java
rename to src/test/java/function/builtin/predicate/NUMERIC_EQUALTest.java
index 21bb8cc..3a71462 100644
--- a/test/function/builtin/predicate/NUMERIC_EQUALTest.java
+++ b/src/test/java/function/builtin/predicate/NUMERIC_EQUALTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.TooFewArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.TooFewArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class NUMERIC_EQUALTest extends SymbolAndFunctionCleaner {
@Test
@@ -56,5 +55,4 @@ public class NUMERIC_EQUALTest extends SymbolAndFunctionCleaner {
public void numericEqualWithTooFewArguments() {
evaluateString("(=)");
}
-
}
diff --git a/test/function/builtin/predicate/NUMERIC_GREATERTest.java b/src/test/java/function/builtin/predicate/NUMERIC_GREATERTest.java
similarity index 99%
rename from test/function/builtin/predicate/NUMERIC_GREATERTest.java
rename to src/test/java/function/builtin/predicate/NUMERIC_GREATERTest.java
index 6867176..16e38bd 100644
--- a/test/function/builtin/predicate/NUMERIC_GREATERTest.java
+++ b/src/test/java/function/builtin/predicate/NUMERIC_GREATERTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.TooFewArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.TooFewArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class NUMERIC_GREATERTest extends SymbolAndFunctionCleaner {
@Test
@@ -56,5 +55,4 @@ public class NUMERIC_GREATERTest extends SymbolAndFunctionCleaner {
public void greaterThanWithTooFewArguments() {
evaluateString("(>)");
}
-
}
diff --git a/test/function/builtin/predicate/NUMERIC_LESSTest.java b/src/test/java/function/builtin/predicate/NUMERIC_LESSTest.java
similarity index 99%
rename from test/function/builtin/predicate/NUMERIC_LESSTest.java
rename to src/test/java/function/builtin/predicate/NUMERIC_LESSTest.java
index 48d3e91..c2147d6 100644
--- a/test/function/builtin/predicate/NUMERIC_LESSTest.java
+++ b/src/test/java/function/builtin/predicate/NUMERIC_LESSTest.java
@@ -1,15 +1,14 @@
package function.builtin.predicate;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.TooFewArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.TooFewArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class NUMERIC_LESSTest extends SymbolAndFunctionCleaner {
@Test
@@ -56,5 +55,4 @@ public class NUMERIC_LESSTest extends SymbolAndFunctionCleaner {
public void lessThanWithTooFewArguments() {
evaluateString("(<)");
}
-
}
diff --git a/test/function/builtin/special/ANDTest.java b/src/test/java/function/builtin/special/ANDTest.java
similarity index 99%
rename from test/function/builtin/special/ANDTest.java
rename to src/test/java/function/builtin/special/ANDTest.java
index d995e0e..9d02cc8 100644
--- a/test/function/builtin/special/ANDTest.java
+++ b/src/test/java/function/builtin/special/ANDTest.java
@@ -1,16 +1,15 @@
package function.builtin.special;
+import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
+import sexpression.LispNumber;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.builtin.EVAL.UndefinedSymbolException;
-import sexpression.LispNumber;
-import testutil.SymbolAndFunctionCleaner;
-
public class ANDTest extends SymbolAndFunctionCleaner {
@Test
@@ -62,5 +61,4 @@ public class ANDTest extends SymbolAndFunctionCleaner {
assertNil(evaluateString(input));
evaluateString("x");
}
-
}
diff --git a/test/function/builtin/special/CASETest.java b/src/test/java/function/builtin/special/CASETest.java
similarity index 99%
rename from test/function/builtin/special/CASETest.java
rename to src/test/java/function/builtin/special/CASETest.java
index 5a8bb20..a113d97 100644
--- a/test/function/builtin/special/CASETest.java
+++ b/src/test/java/function/builtin/special/CASETest.java
@@ -1,15 +1,14 @@
package function.builtin.special;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.TooFewArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.TooFewArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class CASETest extends SymbolAndFunctionCleaner {
@Test
@@ -194,5 +193,4 @@ public class CASETest extends SymbolAndFunctionCleaner {
public void caseWithNilClause() {
evaluateString("(case :a nil)");
}
-
}
diff --git a/test/function/builtin/special/CONDTest.java b/src/test/java/function/builtin/special/CONDTest.java
similarity index 99%
rename from test/function/builtin/special/CONDTest.java
rename to src/test/java/function/builtin/special/CONDTest.java
index 84856b2..fd015c2 100644
--- a/test/function/builtin/special/CONDTest.java
+++ b/src/test/java/function/builtin/special/CONDTest.java
@@ -1,15 +1,14 @@
package function.builtin.special;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.DottedArgumentListException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.DottedArgumentListException;
-import testutil.SymbolAndFunctionCleaner;
-
public class CONDTest extends SymbolAndFunctionCleaner {
@Test
@@ -94,5 +93,4 @@ public class CONDTest extends SymbolAndFunctionCleaner {
public void condWithDottedArgumentList_ThrowsException() {
evaluateString("(apply 'cond (cons '(nil T) 'b))");
}
-
}
diff --git a/test/function/builtin/special/DEFINE_SPECIALTest.java b/src/test/java/function/builtin/special/DEFINE_SPECIALTest.java
similarity index 99%
rename from test/function/builtin/special/DEFINE_SPECIALTest.java
rename to src/test/java/function/builtin/special/DEFINE_SPECIALTest.java
index 8b2fa9a..1453e5f 100644
--- a/test/function/builtin/special/DEFINE_SPECIALTest.java
+++ b/src/test/java/function/builtin/special/DEFINE_SPECIALTest.java
@@ -1,15 +1,5 @@
package function.builtin.special;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.Test;
-
import environment.RuntimeEnvironment;
import error.ErrorManager;
import function.ArgumentValidator.BadArgumentTypeException;
@@ -17,8 +7,17 @@ import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.UserDefinedFunction.IllegalKeywordRestPositionException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class DEFINE_SPECIALTest extends SymbolAndFunctionCleaner {
private ByteArrayOutputStream outputStream;
@@ -186,5 +185,4 @@ public class DEFINE_SPECIALTest extends SymbolAndFunctionCleaner {
assertSExpressionsMatch(parseString("grains"), evaluateString("x"));
}
-
}
diff --git a/test/function/builtin/special/DEFMACROTest.java b/src/test/java/function/builtin/special/DEFMACROTest.java
similarity index 99%
rename from test/function/builtin/special/DEFMACROTest.java
rename to src/test/java/function/builtin/special/DEFMACROTest.java
index b59eeba..2936242 100644
--- a/test/function/builtin/special/DEFMACROTest.java
+++ b/src/test/java/function/builtin/special/DEFMACROTest.java
@@ -1,15 +1,5 @@
package function.builtin.special;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.Test;
-
import environment.RuntimeEnvironment;
import error.ErrorManager;
import function.ArgumentValidator.BadArgumentTypeException;
@@ -17,8 +7,17 @@ import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.UserDefinedFunction.IllegalKeywordRestPositionException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class DEFMACROTest extends SymbolAndFunctionCleaner {
private ByteArrayOutputStream outputStream;
@@ -187,5 +186,4 @@ public class DEFMACROTest extends SymbolAndFunctionCleaner {
evaluateString("(defmacro m (x) `'(+ 2 ,x))");
assertSExpressionsMatch(parseString("(+ 2 25)"), evaluateString("(m 25)"));
}
-
}
diff --git a/test/function/builtin/special/DEFUNTest.java b/src/test/java/function/builtin/special/DEFUNTest.java
similarity index 99%
rename from test/function/builtin/special/DEFUNTest.java
rename to src/test/java/function/builtin/special/DEFUNTest.java
index ba7c68c..ed19758 100644
--- a/test/function/builtin/special/DEFUNTest.java
+++ b/src/test/java/function/builtin/special/DEFUNTest.java
@@ -1,15 +1,5 @@
package function.builtin.special;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.Test;
-
import environment.RuntimeEnvironment;
import error.ErrorManager;
import function.ArgumentValidator.BadArgumentTypeException;
@@ -17,8 +7,17 @@ import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.UserDefinedFunction.IllegalKeywordRestPositionException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class DEFUNTest extends SymbolAndFunctionCleaner {
private ByteArrayOutputStream outputStream;
@@ -185,5 +184,4 @@ public class DEFUNTest extends SymbolAndFunctionCleaner {
assertSExpressionsMatch(parseString("grains"), evaluateString("x"));
}
-
}
diff --git a/test/function/builtin/special/FUSETest.java b/src/test/java/function/builtin/special/FUSETest.java
similarity index 99%
rename from test/function/builtin/special/FUSETest.java
rename to src/test/java/function/builtin/special/FUSETest.java
index 77803a3..ddd9586 100644
--- a/test/function/builtin/special/FUSETest.java
+++ b/src/test/java/function/builtin/special/FUSETest.java
@@ -1,16 +1,15 @@
package function.builtin.special;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
import sexpression.Symbol;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class FUSETest extends SymbolAndFunctionCleaner {
@Test
diff --git a/test/function/builtin/special/IFTest.java b/src/test/java/function/builtin/special/IFTest.java
similarity index 99%
rename from test/function/builtin/special/IFTest.java
rename to src/test/java/function/builtin/special/IFTest.java
index ac19398..6216362 100644
--- a/test/function/builtin/special/IFTest.java
+++ b/src/test/java/function/builtin/special/IFTest.java
@@ -1,16 +1,15 @@
package function.builtin.special;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TypeAssertions.assertNil;
-import static testutil.TypeAssertions.assertT;
-
-import org.junit.Test;
-
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
import testutil.SymbolAndFunctionCleaner;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TypeAssertions.assertNil;
+import static testutil.TypeAssertions.assertT;
+
public class IFTest extends SymbolAndFunctionCleaner {
@Test
@@ -73,5 +72,4 @@ public class IFTest extends SymbolAndFunctionCleaner {
public void ifWithTooManyArguments() {
evaluateString("(if t t t t)");
}
-
}
diff --git a/test/function/builtin/special/LAMBDATest.java b/src/test/java/function/builtin/special/LAMBDATest.java
similarity index 92%
rename from test/function/builtin/special/LAMBDATest.java
rename to src/test/java/function/builtin/special/LAMBDATest.java
index d7b4883..d36a56d 100644
--- a/test/function/builtin/special/LAMBDATest.java
+++ b/src/test/java/function/builtin/special/LAMBDATest.java
@@ -1,5 +1,16 @@
package function.builtin.special;
+import function.ArgumentValidator.BadArgumentTypeException;
+import function.ArgumentValidator.DottedArgumentListException;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import function.builtin.EVAL.UndefinedFunctionException;
+import org.junit.Test;
+import sexpression.Cons;
+import sexpression.LispNumber;
+import sexpression.Symbol;
+import testutil.SymbolAndFunctionCleaner;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static sexpression.LispNumber.ONE;
@@ -9,18 +20,6 @@ import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.BadArgumentTypeException;
-import function.ArgumentValidator.DottedArgumentListException;
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import function.builtin.EVAL.UndefinedFunctionException;
-import sexpression.Cons;
-import sexpression.LispNumber;
-import sexpression.Symbol;
-import testutil.SymbolAndFunctionCleaner;
-
public class LAMBDATest extends SymbolAndFunctionCleaner {
@Test
@@ -48,12 +47,12 @@ public class LAMBDATest extends SymbolAndFunctionCleaner {
public void lambdaExpressionIsLambdaExpression() {
Cons lambdaExpression = new Cons(new Symbol("LAMBDA"), new Cons(NIL, new Cons(NIL, NIL)));
- assertTrue(LAMBDA.isLambdaExpression(lambdaExpression));
+ assertTrue(LAMBDA.Companion.isLambdaExpression(lambdaExpression));
}
@Test
public void somethingElseIsNotLambdaExpression() {
- assertFalse(LAMBDA.isLambdaExpression(T));
+ assertFalse(LAMBDA.Companion.isLambdaExpression(T));
}
@Test
@@ -61,7 +60,7 @@ public class LAMBDATest extends SymbolAndFunctionCleaner {
Cons lambdaExpression = new Cons(new Symbol("LAMBDA"), new Cons(NIL, new Cons(NIL, NIL)));
assertSExpressionsMatch(parseString("(:LAMBDA () ())"),
- LAMBDA.createFunction(lambdaExpression).getLambdaExpression());
+ LAMBDA.Companion.createFunction(lambdaExpression).getLambdaExpression());
}
@Test(expected = DottedArgumentListException.class)
@@ -82,14 +81,14 @@ public class LAMBDATest extends SymbolAndFunctionCleaner {
public void createFunctionWithDottedArgumentList() {
Cons lambdaExpression = new Cons(new Symbol("LAMBDA"), new Cons(NIL, ONE));
- LAMBDA.createFunction(lambdaExpression);
+ LAMBDA.Companion.createFunction(lambdaExpression);
}
@Test(expected = BadArgumentTypeException.class)
public void createFunctionWithNonList() {
Cons lambdaExpression = new Cons(new Symbol("LAMBDA"), ONE);
- LAMBDA.createFunction(lambdaExpression);
+ LAMBDA.Companion.createFunction(lambdaExpression);
}
@Test(expected = BadArgumentTypeException.class)
@@ -147,5 +146,4 @@ public class LAMBDATest extends SymbolAndFunctionCleaner {
assertSExpressionsMatch(parseString("3"), evaluateString("(funcall increment-count)"));
assertSExpressionsMatch(parseString("4"), evaluateString("(funcall increment-count)"));
}
-
}
diff --git a/test/function/builtin/special/LETTest.java b/src/test/java/function/builtin/special/LETTest.java
similarity index 99%
rename from test/function/builtin/special/LETTest.java
rename to src/test/java/function/builtin/special/LETTest.java
index 8646c05..234f50f 100644
--- a/test/function/builtin/special/LETTest.java
+++ b/src/test/java/function/builtin/special/LETTest.java
@@ -1,20 +1,19 @@
package function.builtin.special;
-import static sexpression.Nil.NIL;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
import sexpression.Cons;
import sexpression.LispNumber;
import testutil.SymbolAndFunctionCleaner;
+import static sexpression.Nil.NIL;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class LETTest extends SymbolAndFunctionCleaner {
@Test
@@ -157,5 +156,4 @@ public class LETTest extends SymbolAndFunctionCleaner {
assertSExpressionsMatch(new LispNumber("2"), evaluateString(input));
}
-
}
diff --git a/test/function/builtin/special/LET_STARTest.java b/src/test/java/function/builtin/special/LET_STARTest.java
similarity index 99%
rename from test/function/builtin/special/LET_STARTest.java
rename to src/test/java/function/builtin/special/LET_STARTest.java
index e00a8d9..df7074c 100644
--- a/test/function/builtin/special/LET_STARTest.java
+++ b/src/test/java/function/builtin/special/LET_STARTest.java
@@ -1,20 +1,19 @@
package function.builtin.special;
-import static sexpression.Nil.NIL;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.DottedArgumentListException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
import sexpression.Cons;
import sexpression.LispNumber;
import testutil.SymbolAndFunctionCleaner;
+import static sexpression.Nil.NIL;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class LET_STARTest extends SymbolAndFunctionCleaner {
@Test
@@ -157,5 +156,4 @@ public class LET_STARTest extends SymbolAndFunctionCleaner {
assertSExpressionsMatch(new LispNumber("3"), evaluateString(input));
}
-
}
diff --git a/test/function/builtin/special/ORTest.java b/src/test/java/function/builtin/special/ORTest.java
similarity index 99%
rename from test/function/builtin/special/ORTest.java
rename to src/test/java/function/builtin/special/ORTest.java
index 3e57073..3c19a19 100644
--- a/test/function/builtin/special/ORTest.java
+++ b/src/test/java/function/builtin/special/ORTest.java
@@ -1,16 +1,15 @@
package function.builtin.special;
+import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
+import sexpression.LispNumber;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TypeAssertions.assertNil;
import static testutil.TypeAssertions.assertT;
-import org.junit.Test;
-
-import function.builtin.EVAL.UndefinedSymbolException;
-import sexpression.LispNumber;
-import testutil.SymbolAndFunctionCleaner;
-
public class ORTest extends SymbolAndFunctionCleaner {
@Test
@@ -62,5 +61,4 @@ public class ORTest extends SymbolAndFunctionCleaner {
assertT(evaluateString(input));
evaluateString("x");
}
-
}
diff --git a/test/function/builtin/special/PROGNTest.java b/src/test/java/function/builtin/special/PROGNTest.java
similarity index 99%
rename from test/function/builtin/special/PROGNTest.java
rename to src/test/java/function/builtin/special/PROGNTest.java
index 88ed0c1..ff02fc7 100644
--- a/test/function/builtin/special/PROGNTest.java
+++ b/src/test/java/function/builtin/special/PROGNTest.java
@@ -1,14 +1,13 @@
package function.builtin.special;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
import static testutil.TypeAssertions.assertNil;
-import org.junit.Test;
-
-import testutil.SymbolAndFunctionCleaner;
-
public class PROGNTest extends SymbolAndFunctionCleaner {
@Test
@@ -40,5 +39,4 @@ public class PROGNTest extends SymbolAndFunctionCleaner {
public void prognWithDifferentArgumentTypes() {
assertSExpressionsMatch(parseString("pear"), evaluateString("(progn t nil '(1 2) 'pear)"));
}
-
}
diff --git a/test/function/builtin/special/QUOTETest.java b/src/test/java/function/builtin/special/QUOTETest.java
similarity index 99%
rename from test/function/builtin/special/QUOTETest.java
rename to src/test/java/function/builtin/special/QUOTETest.java
index e93ef55..9092414 100644
--- a/test/function/builtin/special/QUOTETest.java
+++ b/src/test/java/function/builtin/special/QUOTETest.java
@@ -1,15 +1,14 @@
package function.builtin.special;
+import function.ArgumentValidator.TooFewArgumentsException;
+import function.ArgumentValidator.TooManyArgumentsException;
+import org.junit.Test;
+import testutil.SymbolAndFunctionCleaner;
+
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.evaluateString;
import static testutil.TestUtilities.parseString;
-import org.junit.Test;
-
-import function.ArgumentValidator.TooFewArgumentsException;
-import function.ArgumentValidator.TooManyArgumentsException;
-import testutil.SymbolAndFunctionCleaner;
-
public class QUOTETest extends SymbolAndFunctionCleaner {
@Test
@@ -35,5 +34,4 @@ public class QUOTETest extends SymbolAndFunctionCleaner {
public void quoteWithTooManyArguments() {
evaluateString("(quote a b)");
}
-
}
diff --git a/test/function/builtin/special/RECURTest.java b/src/test/java/function/builtin/special/RECURTest.java
similarity index 97%
rename from test/function/builtin/special/RECURTest.java
rename to src/test/java/function/builtin/special/RECURTest.java
index e4ed2e1..56bb983 100644
--- a/test/function/builtin/special/RECURTest.java
+++ b/src/test/java/function/builtin/special/RECURTest.java
@@ -1,21 +1,20 @@
package function.builtin.special;
-import static org.junit.Assert.fail;
-import static testutil.TestUtilities.assertIsErrorWithMessage;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-import static testutil.TestUtilities.parseString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.special.RECUR.NestedRecurException;
import function.builtin.special.RECUR.RecurNotInTailPositionException;
import function.builtin.special.RECUR.RecurOutsideOfFunctionException;
+import org.junit.Test;
import sexpression.SExpression;
import testutil.SymbolAndFunctionCleaner;
+import static org.junit.Assert.fail;
+import static testutil.TestUtilities.assertIsErrorWithMessage;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+import static testutil.TestUtilities.parseString;
+
public class RECURTest extends SymbolAndFunctionCleaner {
@Test(expected = RecurOutsideOfFunctionException.class)
@@ -116,7 +115,8 @@ public class RECURTest extends SymbolAndFunctionCleaner {
try {
evaluateString("(bad-tail-recursive 900)");
fail("expectedException");
- } catch (RecurNotInTailPositionException e) {}
+ } catch (RecurNotInTailPositionException e) {
+ }
assertSExpressionsMatch(parseString("PASS"), evaluateString("(tail-recursive 900)"));
}
@@ -129,7 +129,8 @@ public class RECURTest extends SymbolAndFunctionCleaner {
try {
evaluateString("(bad-tail-recursive 900)");
fail("expectedException");
- } catch (RecurNotInTailPositionException e) {}
+ } catch (RecurNotInTailPositionException e) {
+ }
assertSExpressionsMatch(parseString("PASS"), evaluateString("(tail-recursive 900)"));
}
@@ -142,7 +143,8 @@ public class RECURTest extends SymbolAndFunctionCleaner {
try {
evaluateString("(bad-tail-recursive 900)");
fail("expectedException");
- } catch (NestedRecurException e) {}
+ } catch (NestedRecurException e) {
+ }
assertSExpressionsMatch(parseString("PASS"), evaluateString("(tail-recursive 900)"));
}
@@ -187,5 +189,4 @@ public class RECURTest extends SymbolAndFunctionCleaner {
public void recurNotInTailPositionException_HasCorrectAttributes() {
assertIsErrorWithMessage(new RecurNotInTailPositionException());
}
-
}
diff --git a/test/function/builtin/special/SETQTest.java b/src/test/java/function/builtin/special/SETQTest.java
similarity index 99%
rename from test/function/builtin/special/SETQTest.java
rename to src/test/java/function/builtin/special/SETQTest.java
index 90aad00..c018a0b 100644
--- a/test/function/builtin/special/SETQTest.java
+++ b/src/test/java/function/builtin/special/SETQTest.java
@@ -1,19 +1,18 @@
package function.builtin.special;
-import static org.junit.Assert.assertNull;
-import static testutil.TestUtilities.assertSExpressionsMatch;
-import static testutil.TestUtilities.evaluateString;
-
-import org.junit.Test;
-
import function.ArgumentValidator.BadArgumentTypeException;
import function.ArgumentValidator.TooFewArgumentsException;
import function.ArgumentValidator.TooManyArgumentsException;
import function.builtin.EVAL.UndefinedSymbolException;
+import org.junit.Test;
import sexpression.LispNumber;
import table.SymbolTable;
import testutil.SymbolAndFunctionCleaner;
+import static org.junit.Assert.assertNull;
+import static testutil.TestUtilities.assertSExpressionsMatch;
+import static testutil.TestUtilities.evaluateString;
+
public class SETQTest extends SymbolAndFunctionCleaner {
@Test
@@ -92,5 +91,4 @@ public class SETQTest extends SymbolAndFunctionCleaner {
public void setqWithTooManyArguments() {
evaluateString("(setq a b c)");
}
-
}
diff --git a/test/interpreter/LispInterpreterTest.java b/src/test/java/interpreter/LispInterpreterTest.java
similarity index 95%
rename from test/interpreter/LispInterpreterTest.java
rename to src/test/java/interpreter/LispInterpreterTest.java
index c531f86..659f096 100644
--- a/test/interpreter/LispInterpreterTest.java
+++ b/src/test/java/interpreter/LispInterpreterTest.java
@@ -1,6 +1,17 @@
package interpreter;
-import static error.ErrorManager.Severity.CRITICAL;
+import environment.RuntimeEnvironment;
+import interpreter.LispInterpreterBuilderImpl.InterpreterAlreadyBuiltException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import static error.Severity.CRITICAL;
import static interpreter.InteractiveLispInterpreter.PROMPT;
import static java.text.MessageFormat.format;
import static org.junit.Assert.assertEquals;
@@ -9,21 +20,10 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static testutil.TestUtilities.createInputStreamFromString;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import environment.RuntimeEnvironment;
-import interpreter.LispInterpreterBuilderImpl.InterpreterAlreadyBuiltException;
-
public class LispInterpreterTest {
private static final String TERMINATED = "terminated";
+ private static final String FILE = LispInterpreterTest.class.getResource("file.lisp").getFile();
private Set indicatorSet;
private ByteArrayOutputStream outputStream;
@@ -96,7 +96,7 @@ public class LispInterpreterTest {
@Test
public void buildFileBasedInterpreter() {
setCommonFeatures();
- builder.useFile("test/interpreter/test-files/file.lisp");
+ builder.useFile(FILE);
LispInterpreter interpreter = builder.build();
assertTrue(interpreter instanceof FileLispInterpreter);
@@ -129,7 +129,7 @@ public class LispInterpreterTest {
@Test
public void attemptToBuildInterpreterOnBadFile() {
setCommonFeatures();
- builder.useFile("test/interpreter/test-files/does-not-exist.lisp");
+ builder.useFile("does-not-exist.lisp");
builder.build();
assertErrorMessageWritten();
@@ -166,7 +166,7 @@ public class LispInterpreterTest {
@Test
public void fileBasedInterpreterWorks_PrintsLastValueOnly() {
setCommonFeatures();
- builder.useFile("test/interpreter/test-files/file.lisp");
+ builder.useFile(FILE);
builder.build().interpret();
assertEquals("PICKLE\n\n", outputStream.toString());
@@ -193,5 +193,4 @@ public class LispInterpreterTest {
assertEquals("\n", outputStream.toString());
assertEquals("[error] symbol PICKLE has no value\n", errorOutputStream.toString());
}
-
}
diff --git a/test/parser/LispParserTest.java b/src/test/java/parser/LispParserTest.java
similarity index 99%
rename from test/parser/LispParserTest.java
rename to src/test/java/parser/LispParserTest.java
index 945f9e7..af6b15a 100644
--- a/test/parser/LispParserTest.java
+++ b/src/test/java/parser/LispParserTest.java
@@ -1,6 +1,16 @@
package parser;
-import static error.ErrorManager.Severity.ERROR;
+import error.LispException;
+import org.junit.Test;
+import scanner.LispScanner.UnterminatedStringException;
+import stream.UncheckedIOException;
+import token.Eof.EofEncounteredException;
+import token.RightParenthesis.StartsWithRightParenthesisException;
+import token.TokenFactory.BadCharacterException;
+
+import java.io.InputStream;
+
+import static error.Severity.ERROR;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -17,17 +27,6 @@ import static testutil.TypeAssertions.assertNumber;
import static testutil.TypeAssertions.assertString;
import static testutil.TypeAssertions.assertSymbol;
-import java.io.InputStream;
-
-import org.junit.Test;
-
-import error.LispException;
-import scanner.LispScanner.UnterminatedStringException;
-import stream.UncheckedIOException;
-import token.Eof.EofEncounteredException;
-import token.RightParenthesis.StartsWithRightParenthesisException;
-import token.TokenFactory.BadCharacterException;
-
public class LispParserTest {
private LispParser createLispParser(String input) {
@@ -304,7 +303,8 @@ public class LispParserTest {
try {
parser.getNextSExpression();
fail("Expected LispException");
- } catch (LispException e) {}
+ } catch (LispException e) {
+ }
assertTrue(parser.isEof());
}
@@ -378,5 +378,4 @@ public class LispParserTest {
assertAtSignExpression(parser.getNextSExpression());
assertTrue(parser.isEof());
}
-
}
diff --git a/test/recursion/TailCallTest.java b/src/test/java/recursion/TailCallTest.java
similarity index 99%
rename from test/recursion/TailCallTest.java
rename to src/test/java/recursion/TailCallTest.java
index c192067..f8dd401 100644
--- a/test/recursion/TailCallTest.java
+++ b/src/test/java/recursion/TailCallTest.java
@@ -1,9 +1,9 @@
package recursion;
-import static recursion.TailCalls.done;
-
import org.junit.Test;
+import static recursion.TailCalls.done;
+
public class TailCallTest {
@Test(expected = UnsupportedOperationException.class)
@@ -28,5 +28,4 @@ public class TailCallTest {
public void TailCallsCoverage() {
new TailCalls();
}
-
}
diff --git a/test/scanner/LispCommentRemovingInputStreamTest.java b/src/test/java/scanner/LispCommentRemovingInputStreamTest.java
similarity index 99%
rename from test/scanner/LispCommentRemovingInputStreamTest.java
rename to src/test/java/scanner/LispCommentRemovingInputStreamTest.java
index 7d4d6e7..abf3c05 100644
--- a/test/scanner/LispCommentRemovingInputStreamTest.java
+++ b/src/test/java/scanner/LispCommentRemovingInputStreamTest.java
@@ -1,19 +1,18 @@
package scanner;
-import static error.ErrorManager.Severity.CRITICAL;
+import org.junit.Test;
+import scanner.LispInputStream.MaximumUnreadsExceededException;
+import stream.UncheckedIOException;
+
+import java.io.InputStream;
+
+import static error.Severity.CRITICAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static testutil.TestUtilities.createIOExceptionThrowingInputStream;
import static testutil.TestUtilities.createInputStreamFromString;
-import java.io.InputStream;
-
-import org.junit.Test;
-
-import scanner.LispInputStream.MaximumUnreadsExceededException;
-import stream.UncheckedIOException;
-
public class LispCommentRemovingInputStreamTest {
private String getLispCommentRemovingInputStreamResult(String inputString) {
@@ -226,5 +225,4 @@ public class LispCommentRemovingInputStreamTest {
assertEquals(expectedResult, getLispCommentRemovingInputStreamResult(input));
}
-
}
diff --git a/test/scanner/LispScannerLineColumnTest.java b/src/test/java/scanner/LispScannerLineColumnTest.java
similarity index 99%
rename from test/scanner/LispScannerLineColumnTest.java
rename to src/test/java/scanner/LispScannerLineColumnTest.java
index 78d55b8..201ba9d 100644
--- a/test/scanner/LispScannerLineColumnTest.java
+++ b/src/test/java/scanner/LispScannerLineColumnTest.java
@@ -1,14 +1,13 @@
package scanner;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.createInputStreamFromString;
+import file.FilePosition;
+import org.junit.Test;
+import token.Token;
import java.io.InputStream;
-import org.junit.Test;
-
-import file.FilePosition;
-import token.Token;
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.createInputStreamFromString;
public class LispScannerLineColumnTest {
@@ -134,5 +133,4 @@ public class LispScannerLineColumnTest {
assertTokenLineAndColumnsMatch(input, expectedLinesAndColumns);
}
-
}
diff --git a/test/scanner/LispScannerTextTest.java b/src/test/java/scanner/LispScannerTextTest.java
similarity index 99%
rename from test/scanner/LispScannerTextTest.java
rename to src/test/java/scanner/LispScannerTextTest.java
index 42ab768..9694d43 100644
--- a/test/scanner/LispScannerTextTest.java
+++ b/src/test/java/scanner/LispScannerTextTest.java
@@ -1,13 +1,12 @@
package scanner;
-import static org.junit.Assert.assertEquals;
-import static testutil.TestUtilities.createInputStreamFromString;
+import file.FilePosition;
+import org.junit.Test;
import java.io.InputStream;
-import org.junit.Test;
-
-import file.FilePosition;
+import static org.junit.Assert.assertEquals;
+import static testutil.TestUtilities.createInputStreamFromString;
public class LispScannerTextTest {
@@ -114,5 +113,4 @@ public class LispScannerTextTest {
assertTokenTextMatches(input, expected);
}
-
}
diff --git a/test/scanner/LispScannerTypeTest.java b/src/test/java/scanner/LispScannerTypeTest.java
similarity index 99%
rename from test/scanner/LispScannerTypeTest.java
rename to src/test/java/scanner/LispScannerTypeTest.java
index 58078d7..04f686b 100644
--- a/test/scanner/LispScannerTypeTest.java
+++ b/src/test/java/scanner/LispScannerTypeTest.java
@@ -1,18 +1,7 @@
package scanner;
-import static error.ErrorManager.Severity.ERROR;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static testutil.TestUtilities.createInputStreamFromString;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
import org.junit.Before;
import org.junit.Test;
-
import scanner.LispScanner.UnterminatedStringException;
import token.AtSign;
import token.Backquote;
@@ -27,6 +16,16 @@ import token.RightParenthesis;
import token.Token;
import token.TokenFactory.BadCharacterException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import static error.Severity.ERROR;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static testutil.TestUtilities.createInputStreamFromString;
+
public class LispScannerTypeTest {
private List> expectedTypes;
@@ -306,5 +305,4 @@ public class LispScannerTypeTest {
assertTokenTypesMatch(input);
}
-
}
diff --git a/test/sexpression/SExpressionTest.java b/src/test/java/sexpression/SExpressionTest.java
similarity index 99%
rename from test/sexpression/SExpressionTest.java
rename to src/test/java/sexpression/SExpressionTest.java
index 49be3a6..ab8e99e 100644
--- a/test/sexpression/SExpressionTest.java
+++ b/src/test/java/sexpression/SExpressionTest.java
@@ -1,6 +1,13 @@
package sexpression;
-import static error.ErrorManager.Severity.ERROR;
+import function.UserDefinedFunction;
+import org.junit.Test;
+import sexpression.LispNumber.InvalidNumberException;
+
+import java.math.BigInteger;
+import java.util.Locale;
+
+import static error.Severity.ERROR;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -8,14 +15,6 @@ import static sexpression.Nil.NIL;
import static testutil.TestUtilities.assertSExpressionsMatch;
import static testutil.TestUtilities.makeList;
-import java.math.BigInteger;
-import java.util.Locale;
-
-import org.junit.Test;
-
-import function.UserDefinedFunction;
-import sexpression.LispNumber.InvalidNumberException;
-
public class SExpressionTest {
private void assertSExpressionMatchesString(String expected, SExpression sExpression) {
@@ -221,5 +220,4 @@ public class SExpressionTest {
assertSExpressionsMatch(expression, atSign.getExpression());
}
-
}
diff --git a/test/stream/SafeInputStreamTest.java b/src/test/java/stream/SafeInputStreamTest.java
similarity index 99%
rename from test/stream/SafeInputStreamTest.java
rename to src/test/java/stream/SafeInputStreamTest.java
index 4be1d9c..ded9b5f 100644
--- a/test/stream/SafeInputStreamTest.java
+++ b/src/test/java/stream/SafeInputStreamTest.java
@@ -1,12 +1,12 @@
package stream;
+import org.junit.Before;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static testutil.TestUtilities.createIOExceptionThrowingInputStream;
import static testutil.TestUtilities.createInputStreamFromString;
-import org.junit.Before;
-import org.junit.Test;
-
public class SafeInputStreamTest {
SafeInputStream safe;
@@ -38,5 +38,4 @@ public class SafeInputStreamTest {
public void closeThrowsUncheckedException() {
safeWithException.close();
}
-
}
diff --git a/test/stream/SafeOutputStreamTest.java b/src/test/java/stream/SafeOutputStreamTest.java
similarity index 99%
rename from test/stream/SafeOutputStreamTest.java
rename to src/test/java/stream/SafeOutputStreamTest.java
index 1fc4269..0348cbf 100644
--- a/test/stream/SafeOutputStreamTest.java
+++ b/src/test/java/stream/SafeOutputStreamTest.java
@@ -1,13 +1,13 @@
package stream;
-import static org.junit.Assert.assertEquals;
-import static testutil.TestUtilities.createIOExceptionThrowingOutputStream;
-
-import java.io.ByteArrayOutputStream;
-
import org.junit.Before;
import org.junit.Test;
+import java.io.ByteArrayOutputStream;
+
+import static org.junit.Assert.assertEquals;
+import static testutil.TestUtilities.createIOExceptionThrowingOutputStream;
+
public class SafeOutputStreamTest {
SafeOutputStream safe;
@@ -51,5 +51,4 @@ public class SafeOutputStreamTest {
public void closeThrowsUncheckedException() {
safeWithException.close();
}
-
}
diff --git a/src/test/java/table/ExecutionContextTest.kt b/src/test/java/table/ExecutionContextTest.kt
new file mode 100644
index 0000000..ea99313
--- /dev/null
+++ b/src/test/java/table/ExecutionContextTest.kt
@@ -0,0 +1,97 @@
+package table
+
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.AfterEach
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.TestInstance
+import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
+import sexpression.Nil.NIL
+import sexpression.Symbol.T
+
+@TestInstance(PER_CLASS)
+class ExecutionContextTest {
+
+ private val executionContext: ExecutionContext = ExecutionContext.getInstance()
+
+ @BeforeEach
+ fun setUp() {
+ executionContext.clearContext()
+ }
+
+ @AfterEach
+ fun tearDown() {
+ executionContext.clearContext()
+ }
+
+ @Test
+ fun `assign a new scope`() {
+ val scope = SymbolTable()
+ executionContext.scope = scope
+
+ assertThat(executionContext.scope).isEqualTo(scope)
+ }
+
+ @Test
+ fun `clear the context`() {
+ val scope = SymbolTable()
+ executionContext.scope = scope
+
+ assertThat(executionContext.scope).isEqualTo(scope)
+ executionContext.clearContext()
+ assertThat(executionContext.scope).isNotEqualTo(scope)
+ assertThat(executionContext.scope.parent).isNull()
+ }
+
+ @Test
+ fun `lookup a variable`() {
+ executionContext.scope.put("test", T)
+
+ assertThat(executionContext.lookupSymbolValue("test")).isEqualTo(T)
+ }
+
+ @Test
+ fun `lookup a local variable`() {
+ val scope = SymbolTable(executionContext.scope)
+
+ scope.put("local", T)
+ executionContext.scope = scope
+
+ assertThat(executionContext.lookupSymbolValue("local")).isEqualTo(T)
+ }
+
+ @Test
+ fun `lookup a global variable`() {
+ val scope = SymbolTable(executionContext.scope)
+
+ executionContext.scope.put("global", T)
+ executionContext.scope = scope
+
+ assertThat(executionContext.lookupSymbolValue("global")).isEqualTo(T)
+ }
+
+ @Test
+ fun `lookup a shadowed variable`() {
+ val scope = SymbolTable(executionContext.scope)
+
+ scope.put("shadowed", NIL)
+ executionContext.scope.put("shadowed", T)
+ executionContext.scope = scope
+
+ assertThat(executionContext.lookupSymbolValue("shadowed")).isEqualTo(NIL)
+ }
+
+ @Test
+ fun `restore the global context`() {
+ val global = executionContext.scope
+ val scope1 = SymbolTable(global)
+ val scope2 = SymbolTable(scope1)
+ val scope3 = SymbolTable(scope2)
+ executionContext.scope = scope3
+
+ assertThat(executionContext.scope.isGlobal).isFalse()
+ executionContext.restoreGlobalScope()
+ assertThat(executionContext.scope.isGlobal).isTrue()
+ assertThat(executionContext.scope).isEqualTo(global)
+ }
+}
diff --git a/src/test/java/table/FunctionTableTest.kt b/src/test/java/table/FunctionTableTest.kt
new file mode 100644
index 0000000..27ec5dd
--- /dev/null
+++ b/src/test/java/table/FunctionTableTest.kt
@@ -0,0 +1,138 @@
+package table
+
+import error.Severity
+import function.FunctionNames
+import function.LispFunction
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.AfterEach
+import org.junit.jupiter.api.Assertions.assertThrows
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.TestInstance
+import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
+import sexpression.Cons
+import sexpression.Nil
+import sexpression.Nil.NIL
+import sexpression.Symbol.T
+import table.FunctionTable.LispFunctionInstantiationException
+import table.FunctionTable.defineFunction
+import table.FunctionTable.isAlreadyDefined
+import table.FunctionTable.lookupFunction
+import table.FunctionTable.resetFunctionTable
+import java.util.HashSet
+
+@TestInstance(PER_CLASS)
+class FunctionTableTest {
+
+ @FunctionNames("GOOD")
+ class GoodFunction(name: String) : LispFunction() {
+ override fun call(argumentList: Cons): Nil = NIL
+ }
+
+ @FunctionNames("BAD")
+ class BadFunction : LispFunction() {
+ override fun call(argumentList: Cons): Nil = NIL
+ }
+
+ class UglyFunction : LispFunction() {
+ override fun call(argumentList: Cons): Nil = NIL
+ }
+
+ private fun createLispFunction() = object : LispFunction() {
+ override fun call(argumentList: Cons) = T
+ }
+
+ @BeforeEach
+ fun setUp() {
+ resetFunctionTable()
+ }
+
+ @AfterEach
+ fun tearDown() {
+ resetFunctionTable()
+ }
+
+ @Test
+ fun `built-in function is defined`() {
+ assertThat(isAlreadyDefined("CONS")).isTrue()
+ }
+
+ @Test
+ fun `undefined function is not defined`() {
+ assertThat(isAlreadyDefined("undefined")).isFalse()
+ }
+
+ @Test
+ fun `lookup a built-in function`() {
+ assertThat(lookupFunction("CONS")).isNotNull()
+ }
+
+ @Test
+ fun `look up an undefined function`() {
+ assertThat(lookupFunction("undefined")).isNull()
+ }
+
+ @Test
+ fun `function is defined`() {
+ val functionName = "testFunction"
+ val testFunction = createLispFunction()
+
+ assertThat(lookupFunction(functionName)).isNull()
+ assertThat(isAlreadyDefined(functionName)).isFalse()
+
+ defineFunction(functionName, testFunction)
+
+ assertThat(isAlreadyDefined(functionName)).isTrue()
+ assertThat(lookupFunction(functionName)).isEqualTo(testFunction)
+ }
+
+ @Test
+ fun `function table is reset`() {
+ val functionName = "testFunction"
+ val testFunction = createLispFunction()
+ defineFunction(functionName, testFunction)
+
+ resetFunctionTable()
+
+ assertThat(lookupFunction(functionName)).isNull()
+ assertThat(isAlreadyDefined(functionName)).isFalse()
+ }
+
+ @Test
+ fun `reset function table with custom built-ins`() {
+ val goodBuiltIns = HashSet>()
+ goodBuiltIns.add(GoodFunction::class.java)
+
+ resetFunctionTable(goodBuiltIns)
+
+ assertThat(isAlreadyDefined("GOOD")).isTrue()
+ assertThat(lookupFunction("GOOD")).isNotNull()
+ }
+
+ @Test
+ fun `unable to initialize a built-in function`() {
+ val badBuiltIns = HashSet>()
+ badBuiltIns.add(BadFunction::class.java)
+
+ assertThrows(LispFunctionInstantiationException::class.java) { resetFunctionTable(badBuiltIns) }
+ }
+
+ @Test
+ fun `lispFunctionInstantiationException is cool`() {
+ val e = LispFunctionInstantiationException("Bad")
+
+ assertThat(e.message).isNotEmpty()
+ assertThat(e.severity).isEqualTo(Severity.CRITICAL)
+ }
+
+ @Test
+ fun `built-in without a name doesn't throw an exception`() {
+ val namelessBuiltins = HashSet>()
+ namelessBuiltins.add(UglyFunction::class.java)
+
+ resetFunctionTable(namelessBuiltins)
+
+ assertThat(isAlreadyDefined("UGLY")).isFalse()
+ assertThat(lookupFunction("UGLY")).isNull()
+ }
+}
diff --git a/src/test/java/table/SymbolTableTest.kt b/src/test/java/table/SymbolTableTest.kt
new file mode 100644
index 0000000..8af0072
--- /dev/null
+++ b/src/test/java/table/SymbolTableTest.kt
@@ -0,0 +1,63 @@
+package table
+
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.TestInstance
+import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
+import sexpression.Nil.NIL
+import sexpression.Symbol.T
+
+@TestInstance(PER_CLASS)
+class SymbolTableTest {
+
+ private lateinit var symbolTable: SymbolTable
+
+ @BeforeEach
+ fun setUp() {
+ symbolTable = SymbolTable()
+ }
+
+ @Test
+ fun `lookup a symbol that does not exist`() {
+ assertThat(symbolTable.contains("symbol")).isFalse()
+ }
+
+ @Test
+ fun `lookup a symbol that exists`() {
+ symbolTable.put("symbol", T)
+
+ assertThat(symbolTable.contains("symbol")).isTrue()
+ }
+
+ @Test
+ fun `get the value of a symbol`() {
+ symbolTable.put("symbol", T)
+
+ assertThat(symbolTable.get("symbol")).isEqualTo(T)
+ }
+
+ @Test
+ fun `redefine the value of a symbol`() {
+ symbolTable.put("symbol", T)
+ symbolTable.put("symbol", NIL)
+
+ assertThat(symbolTable.get("symbol")).isEqualTo(NIL)
+ }
+
+ @Test
+ fun `check the value of a parent table`() {
+ val childTable = SymbolTable(symbolTable)
+
+ assertThat(childTable.parent).isEqualTo(symbolTable)
+ }
+
+ @Test
+ fun `lookup a symbol in a parent table`() {
+ symbolTable.put("symbol", T)
+ val childTable = SymbolTable(symbolTable)
+ val parentTable = childTable.parent
+
+ assertThat(parentTable.get("symbol")).isEqualTo(T)
+ }
+}
diff --git a/test/terminal/ControlSequenceHandlerTest.java b/src/test/java/terminal/ControlSequenceHandlerTest.java
similarity index 99%
rename from test/terminal/ControlSequenceHandlerTest.java
rename to src/test/java/terminal/ControlSequenceHandlerTest.java
index df29227..fc157d2 100644
--- a/test/terminal/ControlSequenceHandlerTest.java
+++ b/src/test/java/terminal/ControlSequenceHandlerTest.java
@@ -1,5 +1,12 @@
package terminal;
+import org.junit.Before;
+import org.junit.Test;
+import stream.SafeInputStream;
+import terminal.ControlSequence.NullControlSequence;
+import testutil.TestUtilities;
+import util.Characters;
+
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
@@ -10,14 +17,6 @@ import static terminal.SelectGraphicRendition.RED;
import static terminal.SelectGraphicRendition.RESET;
import static terminal.SelectGraphicRendition.YELLOW;
-import org.junit.Before;
-import org.junit.Test;
-
-import stream.SafeInputStream;
-import terminal.ControlSequence.NullControlSequence;
-import testutil.TestUtilities;
-import util.Characters;
-
public class ControlSequenceHandlerTest {
private ControlSequenceHandler handler;
@@ -132,5 +131,4 @@ public class ControlSequenceHandlerTest {
assertThat(handler.parse(input), is(GREEN));
assertThat(handler.parse(input), is(RESET));
}
-
}
diff --git a/test/terminal/ControlSequenceTest.java b/src/test/java/terminal/ControlSequenceTest.java
similarity index 99%
rename from test/terminal/ControlSequenceTest.java
rename to src/test/java/terminal/ControlSequenceTest.java
index f99132d..c6580a2 100644
--- a/test/terminal/ControlSequenceTest.java
+++ b/src/test/java/terminal/ControlSequenceTest.java
@@ -1,5 +1,15 @@
package terminal;
+import com.googlecode.lanterna.TextColor;
+import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal;
+import com.googlecode.lanterna.terminal.virtual.VirtualTerminal;
+import org.junit.Before;
+import org.junit.Test;
+import terminal.ControlSequence.NullControlSequence;
+
+import java.util.HashSet;
+import java.util.Set;
+
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.isEmptyString;
@@ -10,18 +20,6 @@ import static terminal.SelectGraphicRendition.RED;
import static terminal.SelectGraphicRendition.RESET;
import static terminal.SelectGraphicRendition.YELLOW;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.googlecode.lanterna.TextColor;
-import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal;
-import com.googlecode.lanterna.terminal.virtual.VirtualTerminal;
-
-import terminal.ControlSequence.NullControlSequence;
-
public class ControlSequenceTest {
private Set indicatorSet;
@@ -100,5 +98,4 @@ public class ControlSequenceTest {
for (SelectGraphicRendition sgr : SelectGraphicRendition.values())
SelectGraphicRendition.valueOf(sgr.toString());
}
-
}
diff --git a/test/terminal/FlushListener.java b/src/test/java/terminal/FlushListener.java
similarity index 99%
rename from test/terminal/FlushListener.java
rename to src/test/java/terminal/FlushListener.java
index 8d7c377..7e85885 100644
--- a/test/terminal/FlushListener.java
+++ b/src/test/java/terminal/FlushListener.java
@@ -34,5 +34,4 @@ public class FlushListener implements VirtualTerminalListener {
@Override
public void onClose() {}
-
}
\ No newline at end of file
diff --git a/test/terminal/LispTerminalTest.java b/src/test/java/terminal/LispTerminalTest.java
similarity index 99%
rename from test/terminal/LispTerminalTest.java
rename to src/test/java/terminal/LispTerminalTest.java
index 2892d36..6e1df95 100644
--- a/test/terminal/LispTerminalTest.java
+++ b/src/test/java/terminal/LispTerminalTest.java
@@ -1,5 +1,9 @@
package terminal;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
import static com.googlecode.lanterna.input.KeyType.ArrowDown;
import static com.googlecode.lanterna.input.KeyType.ArrowLeft;
import static com.googlecode.lanterna.input.KeyType.ArrowRight;
@@ -10,10 +14,6 @@ import static com.googlecode.lanterna.input.KeyType.Enter;
import static com.googlecode.lanterna.input.KeyType.Escape;
import static terminal.LispTerminal.END_OF_SEGMENT;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
public class LispTerminalTest {
private VirtualTerminalInteractor terminal;
@@ -491,5 +491,4 @@ public class LispTerminalTest {
terminal.assertScreenText(" ");
terminal.assertCursorPosition(0, 0);
}
-
}
diff --git a/test/terminal/TerminalConfigurationTest.java b/src/test/java/terminal/TerminalConfigurationTest.java
similarity index 99%
rename from test/terminal/TerminalConfigurationTest.java
rename to src/test/java/terminal/TerminalConfigurationTest.java
index 9da9f08..729d9fd 100644
--- a/test/terminal/TerminalConfigurationTest.java
+++ b/src/test/java/terminal/TerminalConfigurationTest.java
@@ -1,14 +1,13 @@
package terminal;
+import org.junit.Before;
+import org.junit.Test;
+import stream.UncheckedIOException;
+
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import org.junit.Before;
-import org.junit.Test;
-
-import stream.UncheckedIOException;
-
public class TerminalConfigurationTest {
TerminalConfiguration configuration;
@@ -37,5 +36,4 @@ public class TerminalConfigurationTest {
public void setOutputPairThrowsUncheckedException() {
configuration.setOutputPair(createIOExceptionThrowingPipedOutputStream(), new PipedInputStream());
}
-
}
diff --git a/test/terminal/TerminalHistoryTest.java b/src/test/java/terminal/TerminalHistoryTest.java
similarity index 99%
rename from test/terminal/TerminalHistoryTest.java
rename to src/test/java/terminal/TerminalHistoryTest.java
index 784d4b0..cebbeaf 100644
--- a/test/terminal/TerminalHistoryTest.java
+++ b/src/test/java/terminal/TerminalHistoryTest.java
@@ -1,12 +1,12 @@
package terminal;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
public class TerminalHistoryTest {
private TerminalHistory history;
@@ -136,5 +136,4 @@ public class TerminalHistoryTest {
assertNext("current");
}
-
}
diff --git a/test/terminal/VirtualTerminalInteractor.java b/src/test/java/terminal/VirtualTerminalInteractor.java
similarity index 96%
rename from test/terminal/VirtualTerminalInteractor.java
rename to src/test/java/terminal/VirtualTerminalInteractor.java
index fac6c91..498842e 100644
--- a/test/terminal/VirtualTerminalInteractor.java
+++ b/src/test/java/terminal/VirtualTerminalInteractor.java
@@ -1,23 +1,22 @@
package terminal;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static terminal.LispTerminal.END_OF_SEGMENT;
-
-import java.io.IOException;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-
import com.googlecode.lanterna.TerminalPosition;
import com.googlecode.lanterna.TerminalSize;
import com.googlecode.lanterna.input.KeyStroke;
import com.googlecode.lanterna.input.KeyType;
import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal;
import com.googlecode.lanterna.terminal.virtual.VirtualTerminal;
-
import stream.UncheckedIOException;
+import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static terminal.LispTerminal.END_OF_SEGMENT;
+
public class VirtualTerminalInteractor {
private PipedOutputStream inputWriter;
@@ -108,7 +107,8 @@ public class VirtualTerminalInteractor {
outputWriter.write(END_OF_SEGMENT);
outputWriter.flush();
waitForFlushes(1);
- } catch (IOException ignored) {}
+ } catch (IOException ignored) {
+ }
}
public void waitForFlushes(int flushCount) {
@@ -119,7 +119,8 @@ public class VirtualTerminalInteractor {
flushListener.reduceFlushCount(flushCount);
}
- } catch (InterruptedException ignored) {}
+ } catch (InterruptedException ignored) {
+ }
}
public void waitForPrompt() {
@@ -162,7 +163,8 @@ public class VirtualTerminalInteractor {
for (int c = inputReader.read(); c != -1; c = inputReader.read())
actual += (char) c;
- } catch (IOException ignored) {}
+ } catch (IOException ignored) {
+ }
assertThat(actual, is(expected));
}
@@ -171,7 +173,7 @@ public class VirtualTerminalInteractor {
try {
inputWriter.write(0);
fail("input stream not closed");
- } catch (IOException ignored) {}
+ } catch (IOException ignored) {
+ }
}
-
}
diff --git a/test/testutil/SymbolAndFunctionCleaner.java b/src/test/java/testutil/SymbolAndFunctionCleaner.java
similarity index 99%
rename from test/testutil/SymbolAndFunctionCleaner.java
rename to src/test/java/testutil/SymbolAndFunctionCleaner.java
index 3181ea0..cd96210 100644
--- a/test/testutil/SymbolAndFunctionCleaner.java
+++ b/src/test/java/testutil/SymbolAndFunctionCleaner.java
@@ -1,12 +1,11 @@
package testutil;
-import static table.FunctionTable.resetFunctionTable;
-
import org.junit.After;
import org.junit.Before;
-
import table.ExecutionContext;
+import static table.FunctionTable.resetFunctionTable;
+
public abstract class SymbolAndFunctionCleaner {
protected ExecutionContext executionContext;
@@ -32,5 +31,4 @@ public abstract class SymbolAndFunctionCleaner {
public void additionalSetUp() {}
public void additionalTearDown() {}
-
}
diff --git a/test/testutil/TestUtilities.java b/src/test/java/testutil/TestUtilities.java
similarity index 98%
rename from test/testutil/TestUtilities.java
rename to src/test/java/testutil/TestUtilities.java
index fd833d6..2f8c3db 100644
--- a/test/testutil/TestUtilities.java
+++ b/src/test/java/testutil/TestUtilities.java
@@ -1,12 +1,9 @@
package testutil;
-import static error.ErrorManager.Severity.ERROR;
-import static function.builtin.EVAL.eval;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.isEmptyOrNullString;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-import static sexpression.Nil.NIL;
+import error.LispException;
+import parser.LispParser;
+import sexpression.Cons;
+import sexpression.SExpression;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -14,10 +11,13 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
-import error.LispException;
-import parser.LispParser;
-import sexpression.Cons;
-import sexpression.SExpression;
+import static error.Severity.ERROR;
+import static function.builtin.EVAL.eval;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.isEmptyOrNullString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
+import static sexpression.Nil.NIL;
public final class TestUtilities {
@@ -96,5 +96,4 @@ public final class TestUtilities {
assertThat(e.getSeverity(), is(ERROR));
assertThat(e.getMessage(), not(isEmptyOrNullString()));
}
-
}
diff --git a/test/testutil/TypeAssertions.java b/src/test/java/testutil/TypeAssertions.java
similarity index 99%
rename from test/testutil/TypeAssertions.java
rename to src/test/java/testutil/TypeAssertions.java
index c18bc7c..09975ab 100644
--- a/test/testutil/TypeAssertions.java
+++ b/src/test/java/testutil/TypeAssertions.java
@@ -1,12 +1,12 @@
package testutil;
+import sexpression.SExpression;
+
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static sexpression.Nil.NIL;
import static sexpression.Symbol.T;
-import sexpression.SExpression;
-
public final class TypeAssertions {
public static void assertList(SExpression sExpression) {
@@ -126,5 +126,4 @@ public final class TypeAssertions {
assertThat(sExpression.isComma(), is(false));
assertThat(sExpression.isAtSign(), is(true));
}
-
}
diff --git a/test/token/TokenFactoryTest.java b/src/test/java/token/TokenFactoryTest.java
similarity index 98%
rename from test/token/TokenFactoryTest.java
rename to src/test/java/token/TokenFactoryTest.java
index 1bdad5f..2354909 100644
--- a/test/token/TokenFactoryTest.java
+++ b/src/test/java/token/TokenFactoryTest.java
@@ -1,19 +1,18 @@
package token;
-import static error.ErrorManager.Severity.CRITICAL;
+import file.FilePosition;
+import org.junit.Before;
+import org.junit.Test;
+import token.TokenFactory.BadCharacterException;
+import token.TokenFactory.EmptyTokenTextException;
+
+import static error.Severity.CRITICAL;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
-import org.junit.Before;
-import org.junit.Test;
-
-import file.FilePosition;
-import token.TokenFactory.BadCharacterException;
-import token.TokenFactory.EmptyTokenTextException;
-
public class TokenFactoryTest {
private TokenFactory tokenFactory;
@@ -123,5 +122,4 @@ public class TokenFactoryTest {
String text = "@";
assertThat(createToken(text), instanceOf(AtSign.class));
}
-
}
diff --git a/test/util/CharactersTest.java b/src/test/java/util/CharactersTest.java
similarity index 99%
rename from test/util/CharactersTest.java
rename to src/test/java/util/CharactersTest.java
index 948226d..a0c4907 100644
--- a/test/util/CharactersTest.java
+++ b/src/test/java/util/CharactersTest.java
@@ -1,12 +1,12 @@
package util;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
+import org.junit.Test;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
public class CharactersTest {
@@ -18,5 +18,4 @@ public class CharactersTest {
constructor.setAccessible(true);
constructor.newInstance();
}
-
}
diff --git a/test/util/PathTest.java b/src/test/java/util/PathTest.java
similarity index 99%
rename from test/util/PathTest.java
rename to src/test/java/util/PathTest.java
index b97b74b..64ee966 100644
--- a/test/util/PathTest.java
+++ b/src/test/java/util/PathTest.java
@@ -1,12 +1,12 @@
package util;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
+import org.junit.Test;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
public class PathTest {
@@ -18,5 +18,4 @@ public class PathTest {
constructor.setAccessible(true);
constructor.newInstance();
}
-
}
diff --git a/test/main/test-files/file.lisp b/src/test/resources/application/file.lisp
similarity index 100%
rename from test/main/test-files/file.lisp
rename to src/test/resources/application/file.lisp
diff --git a/test/function/builtin/test-files/load-bad.lisp b/src/test/resources/function/builtin/load-bad.lisp
similarity index 96%
rename from test/function/builtin/test-files/load-bad.lisp
rename to src/test/resources/function/builtin/load-bad.lisp
index c078133..3406069 100644
--- a/test/function/builtin/test-files/load-bad.lisp
+++ b/src/test/resources/function/builtin/load-bad.lisp
@@ -1,50 +1,50 @@
-)(defun extend-null (the-list)
- (cond
- ((equal (length the-list) 0) t)
- (t nil)
- )
-)
-
-(defun mapcar (function-name the-list)
- (cond
- ((null the-list) nil)
- (t (cons (funcall function-name (first the-list))
- (mapcar function-name (rest the-list))))
- )
-)
-
-(defun maplist (function-name the-list)
- (cond
- ((null the-list) nil)
- (t (cons (funcall function-name the-list)
- (maplist function-name (rest the-list))))
- )
-)
-
-(defun extend-apply (function-name param-list)
- (eval (cons function-name param-list)))
-
-(defun append (listA listB)
- (cond
- ((null listA) listB)
- (t (cons (first listA) (append (rest listA) listB)))
- )
-)
-
-(defun second (listA) (first (rest listA)))
-(defun third (listA) (first (rest (rest listA))))
-(defun fourth (listA) (first (rest (rest (rest listA)))))
-(defun fifth (listA) (first (rest (rest (rest (rest listA))))))
-(defun sixth (listA) (first (rest (rest (rest (rest (rest listA)))))))
-(defun seventh (listA) (first (rest (rest (rest (rest (rest (rest listA))))))))
-(defun eighth (listA) (first (rest (rest (rest (rest (rest (rest (rest listA)))))))))
-(defun ninth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest listA))))))))))
-(defun tenth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest (rest listA)))))))))))
-
-(defun nth (n listA)
- (cond
- ((equal 0 n) (first listA))
- (t (nth (- n 1) (rest listA)))
- )
-)
-
+)(defun extend-null (the-list)
+ (cond
+ ((equal (length the-list) 0) t)
+ (t nil)
+ )
+)
+
+(defun mapcar (function-name the-list)
+ (cond
+ ((null the-list) nil)
+ (t (cons (funcall function-name (first the-list))
+ (mapcar function-name (rest the-list))))
+ )
+)
+
+(defun maplist (function-name the-list)
+ (cond
+ ((null the-list) nil)
+ (t (cons (funcall function-name the-list)
+ (maplist function-name (rest the-list))))
+ )
+)
+
+(defun extend-apply (function-name param-list)
+ (eval (cons function-name param-list)))
+
+(defun append (listA listB)
+ (cond
+ ((null listA) listB)
+ (t (cons (first listA) (append (rest listA) listB)))
+ )
+)
+
+(defun second (listA) (first (rest listA)))
+(defun third (listA) (first (rest (rest listA))))
+(defun fourth (listA) (first (rest (rest (rest listA)))))
+(defun fifth (listA) (first (rest (rest (rest (rest listA))))))
+(defun sixth (listA) (first (rest (rest (rest (rest (rest listA)))))))
+(defun seventh (listA) (first (rest (rest (rest (rest (rest (rest listA))))))))
+(defun eighth (listA) (first (rest (rest (rest (rest (rest (rest (rest listA)))))))))
+(defun ninth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest listA))))))))))
+(defun tenth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest (rest listA)))))))))))
+
+(defun nth (n listA)
+ (cond
+ ((equal 0 n) (first listA))
+ (t (nth (- n 1) (rest listA)))
+ )
+)
+
diff --git a/test/function/builtin/test-files/load-good.lisp b/src/test/resources/function/builtin/load-good.lisp
similarity index 96%
rename from test/function/builtin/test-files/load-good.lisp
rename to src/test/resources/function/builtin/load-good.lisp
index ad42d27..61c8fe3 100644
--- a/test/function/builtin/test-files/load-good.lisp
+++ b/src/test/resources/function/builtin/load-good.lisp
@@ -1,43 +1,43 @@
-(defun extend-null (the-list)
- (cond
- ((equal (length the-list) 0) t)
- (t nil)
- )
-)
-
-(defun mapcar (function-name the-list)
- (cond
- ((null the-list) nil)
- (t (cons (funcall function-name (first the-list))
- (mapcar function-name (rest the-list))))
- )
-)
-
-(defun maplist (function-name the-list)
- (cond
- ((null the-list) nil)
- (t (cons (funcall function-name the-list)
- (maplist function-name (rest the-list))))
- )
-)
-
-(defun extend-apply (function-name param-list)
- (eval (cons function-name param-list)))
-
-(defun second (listA) (first (rest listA)))
-(defun third (listA) (first (rest (rest listA))))
-(defun fourth (listA) (first (rest (rest (rest listA)))))
-(defun fifth (listA) (first (rest (rest (rest (rest listA))))))
-(defun sixth (listA) (first (rest (rest (rest (rest (rest listA)))))))
-(defun seventh (listA) (first (rest (rest (rest (rest (rest (rest listA))))))))
-(defun eighth (listA) (first (rest (rest (rest (rest (rest (rest (rest listA)))))))))
-(defun ninth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest listA))))))))))
-(defun tenth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest (rest listA)))))))))))
-
-(defun nth (n listA)
- (cond
- ((equal 0 n) (first listA))
- (t (nth (- n 1) (rest listA)))
- )
-)
-
+(defun extend-null (the-list)
+ (cond
+ ((equal (length the-list) 0) t)
+ (t nil)
+ )
+)
+
+(defun mapcar (function-name the-list)
+ (cond
+ ((null the-list) nil)
+ (t (cons (funcall function-name (first the-list))
+ (mapcar function-name (rest the-list))))
+ )
+)
+
+(defun maplist (function-name the-list)
+ (cond
+ ((null the-list) nil)
+ (t (cons (funcall function-name the-list)
+ (maplist function-name (rest the-list))))
+ )
+)
+
+(defun extend-apply (function-name param-list)
+ (eval (cons function-name param-list)))
+
+(defun second (listA) (first (rest listA)))
+(defun third (listA) (first (rest (rest listA))))
+(defun fourth (listA) (first (rest (rest (rest listA)))))
+(defun fifth (listA) (first (rest (rest (rest (rest listA))))))
+(defun sixth (listA) (first (rest (rest (rest (rest (rest listA)))))))
+(defun seventh (listA) (first (rest (rest (rest (rest (rest (rest listA))))))))
+(defun eighth (listA) (first (rest (rest (rest (rest (rest (rest (rest listA)))))))))
+(defun ninth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest listA))))))))))
+(defun tenth (listA) (first (rest (rest (rest (rest (rest (rest (rest (rest (rest listA)))))))))))
+
+(defun nth (n listA)
+ (cond
+ ((equal 0 n) (first listA))
+ (t (nth (- n 1) (rest listA)))
+ )
+)
+
diff --git a/test/function/builtin/test-files/nested/included.lisp b/src/test/resources/function/builtin/nested/included.lisp
similarity index 100%
rename from test/function/builtin/test-files/nested/included.lisp
rename to src/test/resources/function/builtin/nested/included.lisp
diff --git a/test/function/builtin/test-files/nested/nested.lisp b/src/test/resources/function/builtin/nested/nested.lisp
similarity index 95%
rename from test/function/builtin/test-files/nested/nested.lisp
rename to src/test/resources/function/builtin/nested/nested.lisp
index 6b67b0b..2dd0091 100644
--- a/test/function/builtin/test-files/nested/nested.lisp
+++ b/src/test/resources/function/builtin/nested/nested.lisp
@@ -1 +1 @@
-(load "included.lisp")
+(load "included.lisp")
diff --git a/test/function/builtin/test-files/nested/one/load-one.lisp b/src/test/resources/function/builtin/nested/one/load-one.lisp
similarity index 100%
rename from test/function/builtin/test-files/nested/one/load-one.lisp
rename to src/test/resources/function/builtin/nested/one/load-one.lisp
diff --git a/test/function/builtin/test-files/nested/one/two/load-two.lisp b/src/test/resources/function/builtin/nested/one/two/load-two.lisp
similarity index 100%
rename from test/function/builtin/test-files/nested/one/two/load-two.lisp
rename to src/test/resources/function/builtin/nested/one/two/load-two.lisp
diff --git a/test/function/builtin/test-files/nested/one/two/three/load-three.lisp b/src/test/resources/function/builtin/nested/one/two/three/load-three.lisp
similarity index 100%
rename from test/function/builtin/test-files/nested/one/two/three/load-three.lisp
rename to src/test/resources/function/builtin/nested/one/two/three/load-three.lisp
diff --git a/test/interpreter/test-files/file.lisp b/src/test/resources/interpreter/file.lisp
similarity index 100%
rename from test/interpreter/test-files/file.lisp
rename to src/test/resources/interpreter/file.lisp
diff --git a/test/table/ExecutionContextTest.java b/test/table/ExecutionContextTest.java
deleted file mode 100644
index 9dacbfc..0000000
--- a/test/table/ExecutionContextTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package table;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ExecutionContextTest {
-
- private ExecutionContext executionContext;
-
- public ExecutionContextTest() {
- this.executionContext = ExecutionContext.getInstance();
- }
-
- @Before
- public void setUp() {
- executionContext.clearContext();
- }
-
- @After
- public void tearDown() {
- executionContext.clearContext();
- }
-
- @Test
- public void assignANewScope() {
- SymbolTable scope = new SymbolTable();
- executionContext.setScope(scope);
-
- assertThat(executionContext.getScope(), is(scope));
- }
-
- @Test
- public void clearContext() {
- SymbolTable scope = new SymbolTable();
- executionContext.setScope(scope);
-
- assertThat(executionContext.getScope(), is(scope));
- executionContext.clearContext();
- assertThat(executionContext.getScope(), is(not(scope)));
- assertThat(executionContext.getScope().getParent(), is(nullValue()));
- }
-
- @Test
- public void lookupVariable() {
- executionContext.getScope().put("test", T);
-
- assertThat(executionContext.lookupSymbolValue("test"), is(T));
- }
-
- @Test
- public void lookupLocalVariable() {
- SymbolTable scope = new SymbolTable(executionContext.getScope());
-
- scope.put("local", T);
- executionContext.setScope(scope);
-
- assertThat(executionContext.lookupSymbolValue("local"), is(T));
- }
-
- @Test
- public void lookupGlobalVariable() {
- SymbolTable scope = new SymbolTable(executionContext.getScope());
-
- executionContext.getScope().put("global", T);
- executionContext.setScope(scope);
-
- assertThat(executionContext.lookupSymbolValue("global"), is(T));
- }
-
- @Test
- public void lookupShadowedVariable() {
- SymbolTable scope = new SymbolTable(executionContext.getScope());
-
- scope.put("shadowed", NIL);
- executionContext.getScope().put("shadowed", T);
- executionContext.setScope(scope);
-
- assertThat(executionContext.lookupSymbolValue("shadowed"), is(NIL));
- }
-
- @Test
- public void restoreGlobalContext() {
- SymbolTable global = executionContext.getScope();
- SymbolTable scope1 = new SymbolTable(global);
- SymbolTable scope2 = new SymbolTable(scope1);
- SymbolTable scope3 = new SymbolTable(scope2);
- executionContext.setScope(scope3);
-
- assertThat(executionContext.getScope().isGlobal(), is(false));
- executionContext.restoreGlobalScope();
- assertThat(executionContext.getScope().isGlobal(), is(true));
- assertThat(executionContext.getScope(), is(global));
- }
-
-}
diff --git a/test/table/FunctionTableTest.java b/test/table/FunctionTableTest.java
deleted file mode 100644
index 254d023..0000000
--- a/test/table/FunctionTableTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package table;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-import static table.FunctionTable.defineFunction;
-import static table.FunctionTable.isAlreadyDefined;
-import static table.FunctionTable.lookupFunction;
-import static table.FunctionTable.resetFunctionTable;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import error.ErrorManager;
-import function.FunctionNames;
-import function.LispFunction;
-import sexpression.Cons;
-import sexpression.SExpression;
-import table.FunctionTable.LispFunctionInstantiationException;
-
-public class FunctionTableTest {
-
- @FunctionNames({ "GOOD" })
- public static class GoodFunction extends LispFunction {
-
- public GoodFunction(String name) {}
-
- @Override
- public SExpression call(Cons argumentList) {
- return NIL;
- }
- }
-
- @FunctionNames({ "BAD" })
- public static class BadFunction extends LispFunction {
-
- @Override
- public SExpression call(Cons argumentList) {
- return NIL;
- }
- }
-
- public static class UglyFunction extends LispFunction {
-
- @Override
- public SExpression call(Cons argumentList) {
- return NIL;
- }
- }
-
- private LispFunction createLispFunction() {
- return new LispFunction() {
-
- @Override
- public SExpression call(Cons argumentList) {
- return T;
- }
- };
- }
-
- @Before
- public void setUp() {
- resetFunctionTable();
- }
-
- @After
- public void tearDown() {
- resetFunctionTable();
- }
-
- @Test
- public void builtInFunctionIsDefined() {
- assertTrue(isAlreadyDefined("CONS"));
- }
-
- @Test
- public void undefinedFunctionIsNotDefined() {
- assertFalse(isAlreadyDefined("undefined"));
- }
-
- @Test
- public void lookupBuiltInFunction_ReturnsFunction() {
- assertNotNull(lookupFunction("CONS"));
- }
-
- @Test
- public void lookupUndefinedFunction_ReturnsNull() {
- assertNull(lookupFunction("undefined"));
- }
-
- @Test
- public void defineFunctionWorks() {
- String functionName = "testFunction";
- LispFunction testFunction = createLispFunction();
-
- assertNull(lookupFunction(functionName));
- assertFalse(isAlreadyDefined(functionName));
-
- defineFunction(functionName, testFunction);
-
- assertTrue(isAlreadyDefined(functionName));
- assertEquals(testFunction, lookupFunction(functionName));
- }
-
- @Test
- public void resetFunctionTableWorks() {
- String functionName = "testFunction";
- LispFunction testFunction = createLispFunction();
- defineFunction(functionName, testFunction);
-
- resetFunctionTable();
-
- assertFalse(isAlreadyDefined(functionName));
- assertNull(lookupFunction(functionName));
- }
-
- @Test
- public void resetWithCustomBuitIns() {
- Set> goodBuiltIns = new HashSet<>();
- goodBuiltIns.add(GoodFunction.class);
-
- resetFunctionTable(goodBuiltIns);
-
- assertTrue(isAlreadyDefined("GOOD"));
- assertNotNull(lookupFunction("GOOD"));
- }
-
- @Test(expected = LispFunctionInstantiationException.class)
- public void unableToInitializeBuiltIn() {
- Set> badBuiltIns = new HashSet<>();
- badBuiltIns.add(BadFunction.class);
-
- resetFunctionTable(badBuiltIns);
- }
-
- @Test
- public void lispFunctionInstantiationException_HasCorrectAttributes() {
- LispFunctionInstantiationException e = new LispFunctionInstantiationException("Bad");
-
- assertNotNull(e.getMessage());
- assertTrue(e.getMessage().length() > 0);
- assertEquals(ErrorManager.Severity.CRITICAL, e.getSeverity());
- }
-
- @Test
- public void namelessBuiltIn_DoesNotCauseNPE() {
- Set> namelessBuiltins = new HashSet<>();
- namelessBuiltins.add(UglyFunction.class);
-
- resetFunctionTable(namelessBuiltins);
-
- assertFalse(isAlreadyDefined("UGLY"));
- assertNull(lookupFunction("UGLY"));
- }
-
-}
diff --git a/test/table/SymbolTableTest.java b/test/table/SymbolTableTest.java
deleted file mode 100644
index 778ed9a..0000000
--- a/test/table/SymbolTableTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package table;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static sexpression.Nil.NIL;
-import static sexpression.Symbol.T;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class SymbolTableTest {
-
- private SymbolTable symbolTable;
-
- @Before
- public void setUp() {
- symbolTable = new SymbolTable();
- }
-
- @Test
- public void lookupSymbolNotInTable() {
- assertFalse(symbolTable.contains("symbol"));
- }
-
- @Test
- public void lookupSymbolInTable() {
- symbolTable.put("symbol", T);
-
- assertTrue(symbolTable.contains("symbol"));
- }
-
- @Test
- public void retrieveSymbolValue() {
- symbolTable.put("symbol", T);
-
- assertEquals(T, symbolTable.get("symbol"));
- }
-
- @Test
- public void redefineSymbolValue() {
- symbolTable.put("symbol", T);
- symbolTable.put("symbol", NIL);
-
- assertEquals(NIL, symbolTable.get("symbol"));
- }
-
- @Test
- public void checkParentTableIsCorrect() {
- SymbolTable childTable = new SymbolTable(symbolTable);
-
- assertEquals(symbolTable, childTable.getParent());
- }
-
- @Test
- public void lookupSymbolInParentTable() {
- symbolTable.put("symbol", T);
- SymbolTable childTable = new SymbolTable(symbolTable);
- SymbolTable parentTable = childTable.getParent();
-
- assertEquals(T, parentTable.get("symbol"));
- }
-
-}