forked from lavina/lavina
1
0
Fork 0

use app version in projection-irc/tests

This commit is contained in:
homycdev 2024-03-14 16:30:30 +03:00
parent ff16a4f1b8
commit dce3f1eacb
2 changed files with 34 additions and 6 deletions

View File

@ -30,7 +30,7 @@ mod cap;
use crate::cap::Capabilities; use crate::cap::Capabilities;
const APP_VERSION: &str = concat!("lavina", "_", env!("CARGO_PKG_VERSION")); pub const APP_VERSION: &str = concat!("lavina", "_", env!("CARGO_PKG_VERSION"));
#[derive(Deserialize, Debug, Clone)] #[derive(Deserialize, Debug, Clone)]
pub struct ServerConfig { pub struct ServerConfig {

View File

@ -10,8 +10,8 @@ use tokio::net::TcpStream;
use lavina_core::repo::{Storage, StorageConfig}; use lavina_core::repo::{Storage, StorageConfig};
use lavina_core::{player::PlayerRegistry, room::RoomRegistry}; use lavina_core::{player::PlayerRegistry, room::RoomRegistry};
use projection_irc::APP_VERSION;
use projection_irc::{launch, read_irc_message, RunningServer, ServerConfig}; use projection_irc::{launch, read_irc_message, RunningServer, ServerConfig};
struct TestScope<'a> { struct TestScope<'a> {
reader: BufReader<ReadHalf<'a>>, reader: BufReader<ReadHalf<'a>>,
writer: WriteHalf<'a>, writer: WriteHalf<'a>,
@ -116,7 +116,14 @@ async fn scenario_basic() -> Result<()> {
s.expect(":testserver 001 tester :Welcome to testserver Server").await?; s.expect(":testserver 001 tester :Welcome to testserver Server").await?;
s.expect(":testserver 002 tester :Welcome to testserver Server").await?; s.expect(":testserver 002 tester :Welcome to testserver Server").await?;
s.expect(":testserver 003 tester :Welcome to testserver Server").await?; s.expect(":testserver 003 tester :Welcome to testserver Server").await?;
s.expect(":testserver 004 tester testserver lavina_0.0.2-dev r CFILPQbcefgijklmnopqrstvz").await?; s.expect(
format!(
":testserver 004 tester testserver {} r CFILPQbcefgijklmnopqrstvz",
&APP_VERSION
)
.as_str(),
)
.await?;
s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?; s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?;
s.expect_nothing().await?; s.expect_nothing().await?;
s.send("QUIT :Leaving").await?; s.send("QUIT :Leaving").await?;
@ -164,7 +171,14 @@ async fn scenario_cap_full_negotiation() -> Result<()> {
s.expect(":testserver 001 tester :Welcome to testserver Server").await?; s.expect(":testserver 001 tester :Welcome to testserver Server").await?;
s.expect(":testserver 002 tester :Welcome to testserver Server").await?; s.expect(":testserver 002 tester :Welcome to testserver Server").await?;
s.expect(":testserver 003 tester :Welcome to testserver Server").await?; s.expect(":testserver 003 tester :Welcome to testserver Server").await?;
s.expect(":testserver 004 tester testserver lavina_0.0.2-dev r CFILPQbcefgijklmnopqrstvz").await?; s.expect(
format!(
":testserver 004 tester testserver {} r CFILPQbcefgijklmnopqrstvz",
&APP_VERSION
)
.as_str(),
)
.await?;
s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?; s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?;
s.expect_nothing().await?; s.expect_nothing().await?;
s.send("QUIT :Leaving").await?; s.send("QUIT :Leaving").await?;
@ -206,7 +220,14 @@ async fn scenario_cap_short_negotiation() -> Result<()> {
s.expect(":testserver 001 tester :Welcome to testserver Server").await?; s.expect(":testserver 001 tester :Welcome to testserver Server").await?;
s.expect(":testserver 002 tester :Welcome to testserver Server").await?; s.expect(":testserver 002 tester :Welcome to testserver Server").await?;
s.expect(":testserver 003 tester :Welcome to testserver Server").await?; s.expect(":testserver 003 tester :Welcome to testserver Server").await?;
s.expect(":testserver 004 tester testserver lavina_0.0.2-dev r CFILPQbcefgijklmnopqrstvz").await?; s.expect(
format!(
":testserver 004 tester testserver {} r CFILPQbcefgijklmnopqrstvz",
&APP_VERSION
)
.as_str(),
)
.await?;
s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?; s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?;
s.expect_nothing().await?; s.expect_nothing().await?;
s.send("QUIT :Leaving").await?; s.send("QUIT :Leaving").await?;
@ -254,7 +275,14 @@ async fn scenario_cap_sasl_fail() -> Result<()> {
s.expect(":testserver 001 tester :Welcome to testserver Server").await?; s.expect(":testserver 001 tester :Welcome to testserver Server").await?;
s.expect(":testserver 002 tester :Welcome to testserver Server").await?; s.expect(":testserver 002 tester :Welcome to testserver Server").await?;
s.expect(":testserver 003 tester :Welcome to testserver Server").await?; s.expect(":testserver 003 tester :Welcome to testserver Server").await?;
s.expect(":testserver 004 tester testserver lavina_0.0.2-dev r CFILPQbcefgijklmnopqrstvz").await?; s.expect(
format!(
":testserver 004 tester testserver {} r CFILPQbcefgijklmnopqrstvz",
&APP_VERSION
)
.as_str(),
)
.await?;
s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?; s.expect(":testserver 005 tester CHANTYPES=# :are supported by this server").await?;
s.expect_nothing().await?; s.expect_nothing().await?;
s.send("QUIT :Leaving").await?; s.send("QUIT :Leaving").await?;