mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Add spec to exercise numeric Enum deserialization
This commit is contained in:
parent
b7a594e00a
commit
a13f0f0f4e
3 changed files with 7 additions and 7 deletions
|
@ -8,7 +8,7 @@ describe DB::Database do
|
|||
|
||||
db.setup_connection do |cnn|
|
||||
cnn_setup += 1
|
||||
cnn.scalar("1").should eq "1"
|
||||
cnn.scalar("a").should eq "a"
|
||||
end
|
||||
|
||||
cnn_setup.should eq(2)
|
||||
|
|
|
@ -187,7 +187,7 @@ class DummyDriver < DB::Driver
|
|||
return (@statement.as(DummyStatement)).params[0]
|
||||
end
|
||||
|
||||
return n
|
||||
n.to_i64? || n
|
||||
end
|
||||
|
||||
def next_column_index : Int32
|
||||
|
|
|
@ -90,10 +90,10 @@ struct ModelWithEnum
|
|||
getter c2 : MyOtherEnum
|
||||
|
||||
enum MyEnum
|
||||
Foo
|
||||
Bar
|
||||
Baz
|
||||
Quux
|
||||
Foo = 0
|
||||
Bar = 1
|
||||
Baz = 2
|
||||
Quux = 3
|
||||
end
|
||||
|
||||
enum MyOtherEnum
|
||||
|
@ -196,7 +196,7 @@ describe "DB::Serializable" do
|
|||
end
|
||||
|
||||
it "should initialize a model with an enum property" do
|
||||
expect_model("1,Baz,LOL", ModelWithEnum, {
|
||||
expect_model("1,2,LOL", ModelWithEnum, {
|
||||
c0: 1,
|
||||
c1: ModelWithEnum::MyEnum::Baz,
|
||||
c2: ModelWithEnum::MyOtherEnum::LOL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue