Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 56f0f0f3ba37
Choose a base ref
...
head repository: crystal-lang/crystal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e99cee2f6b72
Choose a head ref
  • 8 commits
  • 23 files changed
  • 1 contributor

Commits on Jul 29, 2016

  1. 3
    Copy the full SHA
    72662fe View commit details
  2. Lexer: fix couldn't lex two consecutive loc pragmas

    Ary Borenszweig committed Jul 29, 2016
    Copy the full SHA
    98bd3b0 View commit details
  3. Compiler: fixed Call#to_s sometimes not priting parentheses

    Ary Borenszweig committed Jul 29, 2016
    Copy the full SHA
    70ad134 View commit details
  4. Missing call in XML spec

    Ary Borenszweig committed Jul 29, 2016
    Copy the full SHA
    2197516 View commit details
  5. Compiler: a few more refactors

    Ary Borenszweig committed Jul 29, 2016
    Copy the full SHA
    e80cfec View commit details
  6. Compiler: reorganized macro-related code, and fixed #2923

    Ary Borenszweig committed Jul 29, 2016
    Copy the full SHA
    4c4fc59 View commit details
  7. Compiler: small refactor related to fixing missing types

    Ary Borenszweig committed Jul 29, 2016
    Copy the full SHA
    72dbe1f View commit details
  8. Logger: allow passing nil for a null logger. Fixes #3065

    Ary Borenszweig committed Jul 29, 2016
    2
    Copy the full SHA
    e99cee2 View commit details
16 changes: 16 additions & 0 deletions spec/compiler/codegen/macro_spec.cr
Original file line number Diff line number Diff line change
@@ -1395,4 +1395,20 @@ describe "Code gen: macro" do
{% end %}
)).to_string.should eq(%(hello [{"world", "world"}, "world"]))
end

it "retains original yield expression (#2923)" do
run(%(
macro foo
def bar(baz)
{{yield}}
end
end
foo do
baz
end
bar("hi")
)).to_string.should eq("hi")
end
end
17 changes: 17 additions & 0 deletions spec/compiler/lexer/location_spec.cr
Original file line number Diff line number Diff line change
@@ -68,6 +68,23 @@ describe "Lexer: location" do
token.filename.should eq("foo")
end

it "uses two consecutive loc pragma " do
lexer = Lexer.new %(1#<loc:"foo",12,34>#<loc:"foo",56,78>2)
lexer.filename = "bar"

token = lexer.next_token
token.type.should eq(:NUMBER)
token.line_number.should eq(1)
token.column_number.should eq(1)
token.filename.should eq("bar")

token = lexer.next_token
token.type.should eq(:NUMBER)
token.line_number.should eq(56)
token.column_number.should eq(78)
token.filename.should eq("foo")
end

it "assigns correct loc location to node" do
exps = Parser.parse(%[(#<loc:"foo.txt",2,3>1 + 2)]).as(Expressions)
node = exps.expressions.first
1 change: 1 addition & 0 deletions spec/compiler/parser/to_s_spec.cr
Original file line number Diff line number Diff line change
@@ -71,4 +71,5 @@ describe "ASTNode#to_s" do
expect_to_s %(Foo("bar baz": Int32))
expect_to_s %({"foo bar": 1})
expect_to_s %(def foo("bar baz" qux)\nend)
expect_to_s "foo()"
end
1 change: 0 additions & 1 deletion spec/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -259,7 +259,6 @@ def assert_macro_internal(program, sub_node, macro_args, macro_body, expected)

call = Call.new(nil, "", sub_node)
result = program.expand_macro a_macro, call, program, program
result = result.source
result = result.chomp(';')
result.should eq(expected)
end
5 changes: 5 additions & 0 deletions spec/std/logger_spec.cr
Original file line number Diff line number Diff line change
@@ -74,4 +74,9 @@ describe "Logger" do
r.gets.should match(/ ANY -- shard: another message\n/)
end
end

it "can create a logger with nil (#3065)" do
logger = Logger.new(nil)
logger.error("ouch")
end
end
1 change: 1 addition & 0 deletions spec/std/xml/xpath_spec.cr
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ module XML

it "raises on invalid xpath" do
expect_raises XML::Error do
doc = doc()
doc.xpath("coco()")
end
end
Loading