mirror of
https://codeberg.org/icewind/nextcloud-config-parser.git
synced 2026-06-03 08:34:13 +02:00
better glob tests
This commit is contained in:
parent
d13783dbc1
commit
83eed10991
3 changed files with 29 additions and 1 deletions
23
src/nc.rs
23
src/nc.rs
|
|
@ -584,6 +584,29 @@ fn test_parse_config_multiple() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse_config_multiple_no_glob() {
|
||||||
|
let config = config_from_file("tests/configs/multiple/config.php");
|
||||||
|
assert_eq!("https://cloud.example.com", config.nextcloud_url);
|
||||||
|
assert_eq!("oc_", config.database_prefix);
|
||||||
|
assert_debug_equal(
|
||||||
|
&Database::Sqlite {
|
||||||
|
database: "/nc/nextcloud.db".into(),
|
||||||
|
},
|
||||||
|
&config.database,
|
||||||
|
);
|
||||||
|
#[cfg(feature = "db-sqlx")]
|
||||||
|
assert_debug_equal(
|
||||||
|
AnyConnectOptions::from_str("sqlite:///nc/nextcloud.db").unwrap(),
|
||||||
|
config.database.into(),
|
||||||
|
);
|
||||||
|
#[cfg(feature = "redis-connect")]
|
||||||
|
assert_debug_equal(
|
||||||
|
RedisConfig::Single(ConnectionInfo::from_str("redis://127.0.0.1").unwrap()),
|
||||||
|
config.redis,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_config_mysql_fqdn() {
|
fn test_parse_config_mysql_fqdn() {
|
||||||
let config = config_from_file("tests/configs/mysql_fqdn.php");
|
let config = config_from_file("tests/configs/mysql_fqdn.php");
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,7 @@ $CONFIG = [
|
||||||
'redis' => [
|
'redis' => [
|
||||||
'host' => 'localhost'
|
'host' => 'localhost'
|
||||||
],
|
],
|
||||||
'dbtype' => 'sqlite',
|
'dbtype' => 'sqlite3',
|
||||||
|
'dbname' => 'nextcloud',
|
||||||
|
'datadirectory' => '/nc'
|
||||||
];
|
];
|
||||||
|
|
|
||||||
3
tests/configs/multiple/other.php
Normal file
3
tests/configs/multiple/other.php
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
// this file should be ignored
|
||||||
|
$a=1;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue