зеркало из https://github.com/github/bert.git
add time object to bert test
This commit is contained in:
Родитель
a13f8746e6
Коммит
29b475115a
|
@ -43,13 +43,13 @@ Usage
|
|||
|
||||
require 'bert'
|
||||
|
||||
bert = BERT.encode([:user, {:name => 'TPW', :nick => 'mojombo'}])
|
||||
bert = BERT.encode(t[:user, {:name => 'TPW', :nick => 'mojombo'}])
|
||||
# => "\203h\002d\000\004userh\003d\000\004dictl\000\000\000\002d
|
||||
\000\004nickm\000\000\000\amojombojl\000\000\000\002d\000
|
||||
\004namem\000\000\000\003TPWj"
|
||||
|
||||
BERT.decode(bert)
|
||||
# => [:user, {:name => 'TPW', :nick => 'mojombo'}]
|
||||
# => t[:user, {:name => 'TPW', :nick => 'mojombo'}]
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ class BertTest < Test::Unit::TestCase
|
|||
context "BERT" do
|
||||
setup do
|
||||
time = Time.at(1254976067)
|
||||
@ruby = t[:user, {:name => 'TPW'}, [/cat/i, 9.9], nil, true, false, :true, :false]
|
||||
@bert = "\203h\bd\000\004userh\002d\000\004dictl\000\000\000\001h\002d\000\004namem\000\000\000\003TPWjl\000\000\000\002h\003d\000\005regexm\000\000\000\003catm\000\000\000\001ic9.900000000000000e+00\000\000\000\000\000\000\000\000\000\000jh\002d\000\003nild\000\003nilh\002d\000\004boold\000\004trueh\002d\000\004boold\000\005falsed\000\004trued\000\005false"
|
||||
@ebin = "<<131,104,8,100,0,4,117,115,101,114,104,2,100,0,4,100,105,99,116,108,0,0,0,1,104,2,100,0,4,110,97,109,101,109,0,0,0,3,84,80,87,106,108,0,0,0,2,104,3,100,0,5,114,101,103,101,120,109,0,0,0,3,99,97,116,109,0,0,0,1,105,99,57,46,57,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,106,104,2,100,0,3,110,105,108,100,0,3,110,105,108,104,2,100,0,4,98,111,111,108,100,0,4,116,114,117,101,104,2,100,0,4,98,111,111,108,100,0,5,102,97,108,115,101,100,0,4,116,114,117,101,100,0,5,102,97,108,115,101>>"
|
||||
@ruby = t[:user, {:name => 'TPW'}, [/cat/i, 9.9], time,nil, true, false, :true, :false]
|
||||
@bert = "\203h\td\000\004userh\002d\000\004dictl\000\000\000\001h\002d\000\004namem\000\000\000\003TPWjl\000\000\000\002h\003d\000\005regexm\000\000\000\003catm\000\000\000\001ic9.900000000000000e+00\000\000\000\000\000\000\000\000\000\000jh\003d\000\004timen\004\000Cj\315Ja\000h\002d\000\003nild\000\003nilh\002d\000\004boold\000\004trueh\002d\000\004boold\000\005falsed\000\004trued\000\005false"
|
||||
@ebin = "<<131,104,9,100,0,4,117,115,101,114,104,2,100,0,4,100,105,99,116,108,0,0,0,1,104,2,100,0,4,110,97,109,101,109,0,0,0,3,84,80,87,106,108,0,0,0,2,104,3,100,0,5,114,101,103,101,120,109,0,0,0,3,99,97,116,109,0,0,0,1,105,99,57,46,57,48,48,48,48,48,48,48,48,48,48,48,48,48,48,101,43,48,48,0,0,0,0,0,0,0,0,0,0,106,104,3,100,0,4,116,105,109,101,110,4,0,67,106,205,74,97,0,104,2,100,0,3,110,105,108,100,0,3,110,105,108,104,2,100,0,4,98,111,111,108,100,0,4,116,114,117,101,104,2,100,0,4,98,111,111,108,100,0,5,102,97,108,115,101,100,0,4,116,114,117,101,100,0,5,102,97,108,115,101>>"
|
||||
end
|
||||
|
||||
should "encode" do
|
||||
|
|
Загрузка…
Ссылка в новой задаче