mirror of https://github.com/nealey/irc-bot
Fixed easy input parsing bug
This commit is contained in:
parent
b55baf1e92
commit
ba2f2ef892
|
@ -97,7 +97,8 @@ let handle_input cli =
|
||||||
| [] ->
|
| [] ->
|
||||||
()
|
()
|
||||||
| [leftover] ->
|
| [leftover] ->
|
||||||
String.blit leftover 0 cli.ibuf 0 (String.length leftover)
|
cli.ibuf_len := (String.length leftover);
|
||||||
|
String.blit leftover 0 cli.ibuf 0 !(cli.ibuf_len)
|
||||||
| line :: tl ->
|
| line :: tl ->
|
||||||
let parsed = Command.from_string line in
|
let parsed = Command.from_string line in
|
||||||
!(cli.handle_command) cli parsed;
|
!(cli.handle_command) cli parsed;
|
||||||
|
|
4
tests.ml
4
tests.ml
|
@ -27,9 +27,7 @@ let unit_tests =
|
||||||
(Command.from_string ":foo NICK name");
|
(Command.from_string ":foo NICK name");
|
||||||
assert_equal
|
assert_equal
|
||||||
~printer:Command.as_string
|
~printer:Command.as_string
|
||||||
(Command.create
|
(Command.create (Some "foo.bar") "PART" ["#foo"; "#bar"]
|
||||||
(Some "foo.bar")
|
|
||||||
"PART" ["#foo"; "#bar"]
|
|
||||||
(Some "ta ta"))
|
(Some "ta ta"))
|
||||||
(Command.from_string ":foo.bar PART #foo #bar :ta ta");
|
(Command.from_string ":foo.bar PART #foo #bar :ta ta");
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue