Compare commits
No commits in common. "858734384bed5469e59d3aa4f87a0036e9aa3a3f" and "a8575ab8757c3c22c534bcebd2558c712bc6df90" have entirely different histories.
858734384b
...
a8575ab875
@ -210,11 +210,6 @@ if (BUILD_TESTING)
|
|||||||
add_test (NAME custom-static-analysis
|
add_test (NAME custom-static-analysis
|
||||||
COMMAND ${PROJECT_SOURCE_DIR}/test-static)
|
COMMAND ${PROJECT_SOURCE_DIR}/test-static)
|
||||||
endif ()
|
endif ()
|
||||||
option (BUILD_TESTING_WDYE "..." OFF)
|
|
||||||
if (BUILD_TESTING_WDYE)
|
|
||||||
add_subdirectory (liberty/tools/wdye)
|
|
||||||
add_test (NAME integration COMMAND wdye "${PROJECT_SOURCE_DIR}/test.lua")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Various clang-based diagnostics, loads of fake positives and spam
|
# Various clang-based diagnostics, loads of fake positives and spam
|
||||||
file (GLOB clang_tidy_sources *.c)
|
file (GLOB clang_tidy_sources *.c)
|
||||||
|
2
liberty
2
liberty
@ -1 +1 @@
|
|||||||
Subproject commit af889b733e81fa40d7a7ff652386585115e186f5
|
Subproject commit 1930f138d4836f8ed9613a17bfe09dc53441618a
|
52
test
Executable file
52
test
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/expect -f
|
||||||
|
# Very basic end-to-end testing for CI
|
||||||
|
set tempdir [exec mktemp -d]
|
||||||
|
set ::env(XDG_CONFIG_HOME) $tempdir
|
||||||
|
|
||||||
|
# Run the daemon to test against
|
||||||
|
system ./xD --write-default-cfg
|
||||||
|
spawn ./xD -d
|
||||||
|
|
||||||
|
# 10 seconds is a bit too much
|
||||||
|
set timeout 5
|
||||||
|
|
||||||
|
spawn ./xC
|
||||||
|
|
||||||
|
# Fuck this Tcl shit, I want the exit code
|
||||||
|
expect_after {
|
||||||
|
eof {
|
||||||
|
puts ""
|
||||||
|
puts "Child exited prematurely"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Connect to the daemon
|
||||||
|
send "/server add localhost\n"
|
||||||
|
expect "]"
|
||||||
|
send "/set servers.localhost.addresses = \"localhost\"\n"
|
||||||
|
expect "Option changed"
|
||||||
|
send "/disconnect\n"
|
||||||
|
expect "]"
|
||||||
|
send "/connect\n"
|
||||||
|
expect "Welcome to"
|
||||||
|
|
||||||
|
# Try some chatting
|
||||||
|
send "/join #test\n"
|
||||||
|
expect "has joined"
|
||||||
|
send "Hello\n"
|
||||||
|
expect "Hello"
|
||||||
|
|
||||||
|
# Attributes
|
||||||
|
send "\x1bmbBold text! \x1bmc0,5And colors.\n"
|
||||||
|
expect "]"
|
||||||
|
|
||||||
|
# Try basic commands
|
||||||
|
send "/set\n"
|
||||||
|
expect "]"
|
||||||
|
send "/help\n"
|
||||||
|
expect "]"
|
||||||
|
|
||||||
|
# Quit
|
||||||
|
send "/quit\n"
|
||||||
|
expect "Shutting down"
|
72
test.lua
72
test.lua
@ -1,72 +0,0 @@
|
|||||||
#!/usr/bin/env wdye
|
|
||||||
-- Very basic end-to-end testing for CI
|
|
||||||
function exec (...)
|
|
||||||
local p = wdye.spawn(...)
|
|
||||||
local out = wdye.expect(p:eof {function (p) return p[0] end})
|
|
||||||
if not out then
|
|
||||||
error "exec() timeout"
|
|
||||||
end
|
|
||||||
|
|
||||||
local status = p:wait()
|
|
||||||
if status ~= 0 then
|
|
||||||
io.write(out, "\n")
|
|
||||||
error("exit status " .. status)
|
|
||||||
end
|
|
||||||
return out:gsub("%s+$", "")
|
|
||||||
end
|
|
||||||
|
|
||||||
local temp = exec {"mktemp", "-d"}
|
|
||||||
local atexit = {}
|
|
||||||
setmetatable(atexit, {__gc = function () exec {"rm", "-rf", "--", temp} end})
|
|
||||||
|
|
||||||
local env = {XDG_CONFIG_HOME=temp, TERM="xterm"}
|
|
||||||
exec {"./xD", "--write-default-cfg", environ=env}
|
|
||||||
|
|
||||||
-- Run the daemon to test against (assuming the default port 6667)
|
|
||||||
local xD = wdye.spawn {"./xD", "-d", environ=env}
|
|
||||||
local xC = wdye.spawn {"./xC", environ=env}
|
|
||||||
|
|
||||||
function send (...) xC:send(...) end
|
|
||||||
function expect (string)
|
|
||||||
wdye.expect(xC:exact {string},
|
|
||||||
wdye.timeout {5, function (p) error "xC timeout" end},
|
|
||||||
xC:eof {function (p) error "xC exited prematurely" end})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Connect to the daemon
|
|
||||||
send "/server add localhost\n"
|
|
||||||
expect "]"
|
|
||||||
send "/set servers.localhost.addresses = \"localhost\"\n"
|
|
||||||
expect "Option changed"
|
|
||||||
send "/disconnect\n"
|
|
||||||
expect "]"
|
|
||||||
send "/connect\n"
|
|
||||||
expect "Welcome to"
|
|
||||||
|
|
||||||
-- Try some chatting
|
|
||||||
send "/join #test\n"
|
|
||||||
expect "has joined"
|
|
||||||
send "Hello\n"
|
|
||||||
expect "Hello"
|
|
||||||
|
|
||||||
-- Attributes
|
|
||||||
send "\x1bmbBold text! \x1bmc0,5And colors.\n"
|
|
||||||
expect "]"
|
|
||||||
|
|
||||||
-- Try basic commands
|
|
||||||
send "/set\n"
|
|
||||||
expect "]"
|
|
||||||
send "/help\n"
|
|
||||||
expect "]"
|
|
||||||
|
|
||||||
-- Quit
|
|
||||||
send "/quit\n"
|
|
||||||
expect "Shutting down"
|
|
||||||
|
|
||||||
local s1 = xC:wait()
|
|
||||||
assert(s1 == 0, "xC exited abnormally: " .. s1)
|
|
||||||
|
|
||||||
-- Send SIGINT (^C)
|
|
||||||
xD:send "\003"
|
|
||||||
local s2 = xD:wait()
|
|
||||||
assert(s2 == 0, "xD exited abnormally: " .. s2)
|
|
4
xC.c
4
xC.c
@ -7034,7 +7034,9 @@ irc_is_highlight (struct server *s, const char *message)
|
|||||||
cstr_transform (nick, s->irc_tolower);
|
cstr_transform (nick, s->irc_tolower);
|
||||||
|
|
||||||
// Special characters allowed in nicknames by RFC 2812: []\`_^{|} and -
|
// Special characters allowed in nicknames by RFC 2812: []\`_^{|} and -
|
||||||
const char *delimiters = "\t\n\v\f\r !\"#$%&'()*+,./:;<=>?@~";
|
// Also excluded from the ASCII: common user channel prefixes: +%@&~
|
||||||
|
// XXX: why did I exclude those? It won't match when IRC newbies use them.
|
||||||
|
const char *delimiters = ",.;:!?()<>/=#$* \t\r\n\v\f\"'";
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
char *save = NULL;
|
char *save = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user