Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
doorgan authored May 30, 2021
1 parent 7251501 commit 66e45e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add `:sourceror` as a dependency to your project's `mix.exs`:
```elixir
defp deps do
[
{:sourceror, "~> 0.2.2"}
{:sourceror, "~> 0.3.0"}
]
end
```
Expand Down Expand Up @@ -105,7 +105,7 @@ ending up with misplaced comments. Two fields are required for this:
# Comment for :a
:a # Also a comment for :a
""" |> Sourceror.parse_string!()

assert {:__block__, meta, [:a]} = quoted
assert meta[:leading_comments] == [
%{line: 1, previous_eol_count: 1, next_eol_count: 1, text: "# Comment for :a"},
Expand All @@ -125,7 +125,7 @@ ending up with misplaced comments. Two fields are required for this:
# A trailing comment
end # Also a trailing comment for :foo
""" |> Sourceror.parse_string!()
assert {:def, meta, _} = quoted
assert meta[:trailing_comments] == [
%{line: 3, previous_eol_count: 1, next_eol_count: 1, text: "# A trailing comment"},
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Sourceror.MixProject do
use Mix.Project

@version "0.2.2"
@version "0.3.0"
@repo_url "https://github.com/doorgan/sourceror"

def project do
Expand Down
16 changes: 9 additions & 7 deletions test/sourceror_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ defmodule SourcerorTest do

describe "parse_expression/2" do
test "parses only the first valid expression" do
assert {:ok, {:foo, _, [[{{_, _, [:do]}, {_, _, [:ok]}}]]}, _} =
Sourceror.parse_expression(~S"""
foo do
:ok
end
parsed =
Sourceror.parse_expression(~S"""
foo do
:ok
end
42
""")
42
""")

assert {:ok, {:foo, _, [[{{_, _, [:do]}, {_, _, [:ok]}}]]}, _} = parsed
end

test "does not success on empty strings" do
Expand Down

0 comments on commit 66e45e6

Please sign in to comment.