Skip to content

Commit

Permalink
add more extensive CI testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jtracey committed Dec 28, 2024
1 parent 3350ef7 commit 6cb6052
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/rust.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Lint
run: cargo clippy --workspace --tests -D warnings
- name: Build
run: cargo build --verbose
- name: Run tests
- name: Run Rust tests
run: cargo test --verbose
- name: Install weechat
run: sudo apt-get install -y weechat-headless
- name: Run integration test
run: tests/test.sh
16 changes: 16 additions & 0 deletions test/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
()
chr: 65
int: 123456
int: -123456
lon: 1234567890
lon: -1234567890
str: "a string"
str: ""
str: None
buf: Some([98, 117, 102, 102, 101, 114])
buf: None
ptr: 0x1234abcd
ptr: 0x0
tim: 1321993456
arr: [ str: "abc", str: "de", ]
arr: [ int: 123, int: 456, int: 789, ]
15 changes: 15 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

# Runs a quick test to make sure basic functionality is working.
# This starts weechat, adds an insecure relay, then quits weechat,
# so do not run it outside of a testing environment.
if [ "$1" != "I understand what this script does." ] ; then
echo "Do not run this script without reading and understanding it."
exit 1
fi

weechat-headless -r '/secure set relay mypassword ; /set relay.network.password "${sec.data.relay}" ; /relay add weechat 9500' &
cargo run --features=cli -- --host localhost:9500 --init "mypassword" -s test/test.ws > test/out.txt
diff test/out.txt test/expected.txt
3 changes: 3 additions & 0 deletions test/test.ws
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test
input core.weechat /quit
quit

0 comments on commit 6cb6052

Please sign in to comment.