Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] Fwd: Re[2]: [PATCH] lua: add string.fromhex method
@ 2018-08-09 18:35 Nikita Tatunov
  2018-08-09 19:00 ` [tarantool-patches] " Vladislav Shpilevoy
  2018-08-16  6:06 ` [tarantool-patches] " Kirill Yukhin
  0 siblings, 2 replies; 10+ messages in thread
From: Nikita Tatunov @ 2018-08-09 18:35 UTC (permalink / raw)
  To: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 3295 bytes --]




-------- Пересылаемое сообщение --------
От кого: Nikita Tatunov <n.tatunov@tarantool.org>
Кому: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Копия: tarantool-patches@freelists.org, Alexander Turenko <alexander.turenko@tarantool.org>
Дата: Четверг,  9 августа 2018, 13:07 +03:00
Тема: Re[2]: [PATCH] lua: add string.fromhex method


Hello, Alexander, thnx for review!
Vlad, could you please take a look?

>Четверг,  9 августа 2018, 10:06 +03:00 от Alexander Turenko <  alexander.turenko@tarantool.org >:
>
>Hi, Nikita!
>
>The implementation LGTM.
>
>See minor comments about the test below.
>
>Please, proceed the next review round with Vlad.
>
>WBR, Alexander Turenko.
>
>On Wed, Aug 08, 2018 at 03:21:03PM +0300, N.Tatunov wrote:
>> Add string.fromhex method. Add test for string.fromhex().
>> 
>> Closes #2562
>> ---
>> 
>> Issue:  https://github.com/tarantool/tarantool/issues/2562
>> Branch:  https://github.com/tarantool/tarantool/tree/N_Tatunov/gh-2562-fromhex-method
>>
>> <...>
>>
>> diff --git a/test/app-tap/string.test.lua b/test/app-tap/string.test.lua
>> index 1d10dcfc9..f88296fff 100755
>> --- a/test/app-tap/string.test.lua
>> +++ b/test/app-tap/string.test.lua
>> @@ -3,7 +3,7 @@
>>  local tap = require('tap')
>>  local test = tap.test("string extensions")
>> 
>> -test:plan(6)
>> +test:plan(7)
>> 
>>  test:test("split", function(test)
>>      test:plan(10)
>> @@ -114,6 +114,25 @@ test:test("hex", function(test)
>>      test:is(string.hex(""), "", "hex empty string")
>>  end)
>> 
>> +test:test("fromhex", function(test)
>> +    test:plan(11)
>> +    test:is(string.fromhex("48656c6c6f"), "Hello", "from hex to bin")
>> +    test:is(string.fromhex("4c696e7578"), "Linux", "from hex to bin")
>> +    test:is(string.fromhex("6C6F72656D"), "lorem", "from hex to bin")
>> +    test:is(string.fromhex("697073756D"), "ipsum", "from hex to bin")
>> +    test:is(string.fromhex("6c6f72656d"), "lorem", "from hex to bin")
>> +    test:is(string.fromhex("697073756d"), "ipsum", "from hex to bin")
>> +    test:is(string.fromhex("6A6B6C6D6E6F"), "jklmno", "from hex to bin")
>> +    test:is(string.fromhex("6a6b6c6d6e6f"), "jklmno", "from hex to bin")
>> +    local _, err = pcall(string.fromhex, 'aaa')
>
>Use double quotes when a file primarily uses this quotes type.
>

Fixed.

>> +    test:ok(err and err:match("(even amount of chars expected," ..
>> +                    " got odd amount)"), err)
>
>1. Indent is strange (don't get what is the rule).
>2. Don't use `err` for diagnostics (the message could can be unusable in case of an
>   error).

Didn't notice it, thnx.
>
>> +    local _, err = pcall(string.fromhex, 'qq')
>
>Single qutoes -> doule quotes.
>

Fixed.

>> +    test:ok(err and err:match("(hex string expected, got non hex chars)"), err)
>> +    local _, err = pcall(string.fromhex, 795)
>> +    test:ok(err and err:match("(string expected, got " .. type(795) .. ")"))
>
>type(795) -> number
>

Changed.

>> +end)
>> +
>>  test:test("strip", function(test)
>>      test:plan(6)
>>      local str = "  hello hello "
>> -- 
>> 2.15.2 (Apple Git-101.1)
>> 


-- 
WBR, Nikita Tatunov.

----------------------------------------------------------------------

-- 
WBR, Nikita Tatunov.

[-- Attachment #2: Type: text/html, Size: 4712 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-08-16 16:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 18:35 [tarantool-patches] Fwd: Re[2]: [PATCH] lua: add string.fromhex method Nikita Tatunov
2018-08-09 19:00 ` [tarantool-patches] " Vladislav Shpilevoy
2018-08-09 19:02   ` [tarantool-patches] Re[2]: [tarantool-patches] " Nikita Tatunov
2018-08-13 14:46     ` [tarantool-patches] Re: Re[2]: " Vladislav Shpilevoy
2018-08-13 15:04       ` Alexander Turenko
2018-08-15 14:01         ` [tarantool-patches] " Nikita Tatunov
2018-08-15 14:06           ` Vladislav Shpilevoy
2018-08-16  6:06 ` [tarantool-patches] " Kirill Yukhin
2018-08-16  9:28   ` [tarantool-patches] " Alexander Turenko
2018-08-16 16:07     ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox