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: 74cf7c49b540
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: 7b32e25b5bb6
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Apr 19, 2018

  1. Copy the full SHA
    c109bb5 View commit details
  2. Merge pull request #5968 from sdogruyol/remove-class-spec-todos

    Remove TODOs from class spec
    asterite authored Apr 19, 2018
    Copy the full SHA
    7b32e25 View commit details
Showing with 99 additions and 101 deletions.
  1. +99 −101 spec/std/class_spec.cr
200 changes: 99 additions & 101 deletions spec/std/class_spec.cr
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
require "spec"

# TODO: uncomment at v > 0.24
# private class A
# end
private class A
end

# private class B1 < A
# end
private class B1 < A
end

# private class C1 < B1
# end
private class C1 < B1
end

# private class B2 < A
# end
private class B2 < A
end

describe Class do
it "does ===" do
@@ -51,96 +50,95 @@ describe Class do
Int32?.nilable?.should be_true
end

# TODO: uncomment at v > 0.24
# describe "comparison operators" do
# t = [A, B1, B2, C1]

# it "<" do
# (t[0] < t[0]).should eq(false)
# (t[0] < t[1]).should eq(false)
# (t[0] < t[2]).should eq(false)
# (t[0] < t[3]).should eq(false)

# (t[1] < t[0]).should eq(true)
# (t[1] < t[1]).should eq(false)
# (t[1] < t[2]).should eq(false)
# (t[1] < t[3]).should eq(false)

# (t[2] < t[0]).should eq(true)
# (t[2] < t[1]).should eq(false)
# (t[2] < t[2]).should eq(false)
# (t[2] < t[3]).should eq(false)

# (t[3] < t[0]).should eq(true)
# (t[3] < t[1]).should eq(true)
# (t[3] < t[2]).should eq(false)
# (t[3] < t[3]).should eq(false)
# end

# it "<=" do
# (t[0] <= t[0]).should eq(true)
# (t[0] <= t[1]).should eq(false)
# (t[0] <= t[2]).should eq(false)
# (t[0] <= t[3]).should eq(false)

# (t[1] <= t[0]).should eq(true)
# (t[1] <= t[1]).should eq(true)
# (t[1] <= t[2]).should eq(false)
# (t[1] <= t[3]).should eq(false)

# (t[2] <= t[0]).should eq(true)
# (t[2] <= t[1]).should eq(false)
# (t[2] <= t[2]).should eq(true)
# (t[2] <= t[3]).should eq(false)

# (t[3] <= t[0]).should eq(true)
# (t[3] <= t[1]).should eq(true)
# (t[3] <= t[2]).should eq(false)
# (t[3] <= t[3]).should eq(true)
# end

# it ">" do
# (t[0] > t[0]).should eq(false)
# (t[0] > t[1]).should eq(true)
# (t[0] > t[2]).should eq(true)
# (t[0] > t[3]).should eq(true)

# (t[1] > t[0]).should eq(false)
# (t[1] > t[1]).should eq(false)
# (t[1] > t[2]).should eq(false)
# (t[1] > t[3]).should eq(true)

# (t[2] > t[0]).should eq(false)
# (t[2] > t[1]).should eq(false)
# (t[2] > t[2]).should eq(false)
# (t[2] > t[3]).should eq(false)

# (t[3] > t[0]).should eq(false)
# (t[3] > t[1]).should eq(false)
# (t[3] > t[2]).should eq(false)
# (t[3] > t[3]).should eq(false)
# end

# it ">=" do
# (t[0] >= t[0]).should eq(true)
# (t[0] >= t[1]).should eq(true)
# (t[0] >= t[2]).should eq(true)
# (t[0] >= t[3]).should eq(true)

# (t[1] >= t[0]).should eq(false)
# (t[1] >= t[1]).should eq(true)
# (t[1] >= t[2]).should eq(false)
# (t[1] >= t[3]).should eq(true)

# (t[2] >= t[0]).should eq(false)
# (t[2] >= t[1]).should eq(false)
# (t[2] >= t[2]).should eq(true)
# (t[2] >= t[3]).should eq(false)

# (t[3] >= t[0]).should eq(false)
# (t[3] >= t[1]).should eq(false)
# (t[3] >= t[2]).should eq(false)
# (t[3] >= t[3]).should eq(true)
# end
# end
describe "comparison operators" do
t = [A, B1, B2, C1]

it "<" do
(t[0] < t[0]).should be_false
(t[0] < t[1]).should be_false
(t[0] < t[2]).should be_false
(t[0] < t[3]).should be_false

(t[1] < t[0]).should be_true
(t[1] < t[1]).should be_false
(t[1] < t[2]).should be_false
(t[1] < t[3]).should be_false

(t[2] < t[0]).should be_true
(t[2] < t[1]).should be_false
(t[2] < t[2]).should be_false
(t[2] < t[3]).should be_false

(t[3] < t[0]).should be_true
(t[3] < t[1]).should be_true
(t[3] < t[2]).should be_false
(t[3] < t[3]).should be_false
end

it "<=" do
(t[0] <= t[0]).should be_true
(t[0] <= t[1]).should be_false
(t[0] <= t[2]).should be_false
(t[0] <= t[3]).should be_false

(t[1] <= t[0]).should be_true
(t[1] <= t[1]).should be_true
(t[1] <= t[2]).should be_false
(t[1] <= t[3]).should be_false

(t[2] <= t[0]).should be_true
(t[2] <= t[1]).should be_false
(t[2] <= t[2]).should be_true
(t[2] <= t[3]).should be_false

(t[3] <= t[0]).should be_true
(t[3] <= t[1]).should be_true
(t[3] <= t[2]).should be_false
(t[3] <= t[3]).should be_true
end

it ">" do
(t[0] > t[0]).should be_false
(t[0] > t[1]).should be_true
(t[0] > t[2]).should be_true
(t[0] > t[3]).should be_true

(t[1] > t[0]).should be_false
(t[1] > t[1]).should be_false
(t[1] > t[2]).should be_false
(t[1] > t[3]).should be_true

(t[2] > t[0]).should be_false
(t[2] > t[1]).should be_false
(t[2] > t[2]).should be_false
(t[2] > t[3]).should be_false

(t[3] > t[0]).should be_false
(t[3] > t[1]).should be_false
(t[3] > t[2]).should be_false
(t[3] > t[3]).should be_false
end

it ">=" do
(t[0] >= t[0]).should be_true
(t[0] >= t[1]).should be_true
(t[0] >= t[2]).should be_true
(t[0] >= t[3]).should be_true

(t[1] >= t[0]).should be_false
(t[1] >= t[1]).should be_true
(t[1] >= t[2]).should be_false
(t[1] >= t[3]).should be_true

(t[2] >= t[0]).should be_false
(t[2] >= t[1]).should be_false
(t[2] >= t[2]).should be_true
(t[2] >= t[3]).should be_false

(t[3] >= t[0]).should be_false
(t[3] >= t[1]).should be_false
(t[3] >= t[2]).should be_false
(t[3] >= t[3]).should be_true
end
end
end