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: 0d4c040abff3
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: 7ca33b93599e
Choose a head ref
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Apr 12, 2017

  1. Capitalize remaining lowercase stdlib exception messages

    Sija authored and Ary Borenszweig committed Apr 12, 2017
    Copy the full SHA
    2cd94c2 View commit details
  2. Use Bytes type idiom in HTTP::WebSocket#on_binary

    Sija authored and Ary Borenszweig committed Apr 12, 2017
    Copy the full SHA
    c7720ae View commit details
  3. Reformat File.write comment

    Sija authored and Ary Borenszweig committed Apr 12, 2017
    Copy the full SHA
    7ca33b9 View commit details
Showing with 14 additions and 14 deletions.
  1. +3 −3 spec/std/option_parser_spec.cr
  2. +4 −4 src/file.cr
  3. +1 −1 src/http/web_socket.cr
  4. +1 −1 src/openssl/ssl/socket.cr
  5. +1 −1 src/option_parser.cr
  6. +1 −1 src/slice.cr
  7. +3 −3 src/yaml/pull_parser.cr
6 changes: 3 additions & 3 deletions spec/std/option_parser_spec.cr
Original file line number Diff line number Diff line change
@@ -423,15 +423,15 @@ describe "OptionParser" do

it "raises if flag doesn't start with dash (#4001)" do
OptionParser.parse([] of String) do |opts|
expect_raises ArgumentError, %(argument 'flag' ("foo") must start with a dash) do
expect_raises ArgumentError, %(Argument 'flag' ("foo") must start with a dash) do
opts.on("foo", "") { }
end

expect_raises ArgumentError, %(argument 'short_flag' ("foo") must start with a dash) do
expect_raises ArgumentError, %(Argument 'short_flag' ("foo") must start with a dash) do
opts.on("foo", "bar", "baz") { }
end

expect_raises ArgumentError, %(argument 'long_flag' ("bar") must start with a dash) do
expect_raises ArgumentError, %(Argument 'long_flag' ("bar") must start with a dash) do
opts.on("-foo", "bar", "baz") { }
end

8 changes: 4 additions & 4 deletions src/file.cr
Original file line number Diff line number Diff line change
@@ -502,10 +502,10 @@ class File < IO::FileDescriptor
# File.write("foo", "bar")
# ```
#
# If the content is a `Slice(UInt8)`, those bytes will be written. If it's
# an `IO`, all bytes from the `IO` will be written. Otherwise, the string
# representation of *content* will be written (the result of invoking `to_s`
# on *content*)
# NOTE: If the content is a `Slice(UInt8)`, those bytes will be written.
# If it's an `IO`, all bytes from the `IO` will be written.
# Otherwise, the string representation of *content* will be written
# (the result of invoking `to_s` on *content*).
def self.write(filename, content, perm = DEFAULT_CREATE_MODE, encoding = nil, invalid = nil)
File.open(filename, "w", perm, encoding: encoding, invalid: invalid) do |file|
case content
2 changes: 1 addition & 1 deletion src/http/web_socket.cr
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ class HTTP::WebSocket
def on_message(&@on_message : String ->)
end

def on_binary(&@on_binary : Slice(UInt8) ->)
def on_binary(&@on_binary : Bytes ->)
end

def on_close(&@on_close : String ->)
2 changes: 1 addition & 1 deletion src/openssl/ssl/socket.cr
Original file line number Diff line number Diff line change
@@ -167,6 +167,6 @@ abstract class OpenSSL::SSL::Socket
end

def unbuffered_rewind
raise IO::Error.new("can't rewind OpenSSL::SSL::Socket::Client")
raise IO::Error.new("Can't rewind OpenSSL::SSL::Socket::Client")
end
end
2 changes: 1 addition & 1 deletion src/option_parser.cr
Original file line number Diff line number Diff line change
@@ -189,7 +189,7 @@ class OptionParser
return if allow_empty && arg.empty?

unless arg.starts_with?('-')
raise ArgumentError.new("argument '#{name}' (#{arg.inspect}) must start with a dash (-)")
raise ArgumentError.new("Argument '#{name}' (#{arg.inspect}) must start with a dash (-)")
end
end

2 changes: 1 addition & 1 deletion src/slice.cr
Original file line number Diff line number Diff line change
@@ -492,7 +492,7 @@ struct Slice(T)
end

protected def check_writable
raise "can't write to read-only Slice" if @read_only
raise "Can't write to read-only Slice" if @read_only
end
end

6 changes: 3 additions & 3 deletions src/yaml/pull_parser.cr
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ class YAML::PullParser
when EventKind::SEQUENCE_START, EventKind::MAPPING_START
String.build { |io| read_raw(io) }
else
raise "unexpected kind: #{kind}"
raise "Unexpected kind: #{kind}"
end
end

@@ -216,7 +216,7 @@ class YAML::PullParser
io << "}"
read_next
else
raise "unexpected kind: #{kind}"
raise "Unexpected kind: #{kind}"
end
end

@@ -299,7 +299,7 @@ class YAML::PullParser
end

private def expect_kind(kind)
raise "expected #{kind} but was #{self.kind}" unless kind == self.kind
raise "Expected #{kind} but was #{self.kind}" unless kind == self.kind
end

private def read_anchor(anchor)