-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make method 'nestedApplications' public (#345)
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
kernel/src/test/scala/me/rexim/morganey/ast/LambdaTermSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.rexim.morganey.ast | ||
|
||
import me.rexim.morganey.ast.LambdaTermHelpers._ | ||
import me.rexim.morganey.helpers.TestTerms | ||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
class LambdaTermSpec extends FlatSpec with Matchers with TestTerms { | ||
|
||
behavior of "A lambda application" | ||
|
||
it should "be able to extract the nested applications" in { | ||
|
||
def nestedApps(n: Int): LambdaApp = | ||
(1 until n).map(_ => d).foldLeft(lapp(x, d))(lapp) | ||
|
||
nestedApps(1).nestedApplications() should be (x, List(d)) | ||
nestedApps(2).nestedApplications() should be (x, List(d, d)) | ||
nestedApps(5).nestedApplications() should be (x, List(d, d, d, d, d)) | ||
|
||
} | ||
|
||
} |