-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to fix #305 It seems that AST that our macro produces is spliced into AST of the expression provided to Expecty.expect Then it tries to evaluate this composed AST, but it fails, I'm not exactly sure why, maybe some local vals in macro arent simply available in the scope where expecty evaluates them. I think Expecty.expect should expand only AST of expression provided to it (and do not follow macros and splice ASTs generated by them) This PR rewrites macro a little bit not to use values calculated in macro itself (it also removes potentially problematic Expr.apply call). As a consequence we have to make a segmentsFromString public, because call to it is also inlined. This change fixes compilation of expecty macros, but due to the fact that expecty expands AST too much, its assertion clues will be malformed anyway, but I don't think we would be able to solve this in os-lib. Note: Using scala 2 there is no bug.
- Loading branch information
1 parent
0ba9dfb
commit 92c5a94
Showing
5 changed files
with
41 additions
and
7 deletions.
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
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
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
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,33 @@ | ||
package test.os | ||
|
||
import os._ | ||
import utest._ | ||
import com.eed3si9n.expecty.Expecty.expect | ||
|
||
object ExpectyIntegration extends TestSuite { | ||
val tests = Tests { | ||
test("Literals") { | ||
test("Basic") { | ||
expect(rel / "src" / "Main/.scala" == rel / "src" / "Main" / ".scala") | ||
expect(root / "core/src/test" == root / "core" / "src" / "test") | ||
expect(root / "core/src/test" == root / "core" / "src/test") | ||
} | ||
test("literals with [..]") { | ||
expect(rel / "src" / ".." == rel / "src" / os.up) | ||
expect(root / "src/.." == root / "src" / os.up) | ||
expect(root / "src" / ".." == root / "src" / os.up) | ||
expect(root / "hello" / ".." / "world" == root / "hello" / os.up / "world") | ||
expect(root / "hello" / "../world" == root / "hello" / os.up / "world") | ||
expect(root / "hello/../world" == root / "hello" / os.up / "world") | ||
} | ||
test("from issue") { | ||
expect(Seq(os.pwd / "foo") == Seq(os.pwd / "foo")) | ||
val path = os.Path("/") / "tmp" / "foo" | ||
expect(path.startsWith(os.Path("/") / "tmp")) | ||
} | ||
test("multiple args") { | ||
expect(rel / "src" / ".." == rel / "src" / os.up, root / "src/.." == root / "src" / os.up) | ||
} | ||
} | ||
} | ||
} |
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