Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that libs can be used with the rc build variant #343

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,34 @@ jobs:
- name: Test with optimizations
run: just test_release --verbose

build_and_test_rc:
# We don't need to test rc builds on all platforms for now
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: [email protected]

- name: Test the rc build variant
run: just test_rc --verbose

build_and_test_release_rc:
# We don't need to test rc builds on all platforms for now
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: [email protected]

- name: Test the rc build variant
run: just test_rc --release --verbose

code_checks:
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion crates/parser/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ impl TryFrom<u8> for MetaKeyId {
fn try_from(byte: u8) -> Result<Self, Self::Error> {
if byte < Self::Invalid as u8 {
// Safety: Any value less than Invalid is safe to transmute.
Ok(unsafe { std::mem::transmute(byte) })
Ok(unsafe { std::mem::transmute::<u8, Self>(byte) })
} else {
Err(byte)
}
Expand Down
1 change: 0 additions & 1 deletion crates/parser/src/string_format_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ mod tests {
fill_character: Some(0),
min_width: Some(20),
precision: Some(10),
..Default::default()
},
),
(
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ chrono = { workspace = true, features = ["wasmbind"] }
instant = { workspace = true, features = ["wasm-bindgen"] }

[dev-dependencies]
koto_test_utils = { path = "../test_utils" }
koto_test_utils = { path = "../test_utils", default-features = false }
test-case = { workspace = true }
4 changes: 2 additions & 2 deletions crates/runtime/src/types/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ impl KMap {
}

/// Returns a clone of the data value corresponding to the given key
pub fn get<K: ?Sized>(&self, key: &K) -> Option<KValue>
pub fn get<K>(&self, key: &K) -> Option<KValue>
where
K: Hash + Equivalent<ValueKey>,
K: Hash + Equivalent<ValueKey> + ?Sized,
{
self.data.borrow().get(key).cloned()
}
Expand Down
6 changes: 4 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ test *args:
cargo test {{args}}

test_rc *args:
cargo test -p koto_runtime --no-default-features --features rc {{args}}
cargo test --no-default-features --features rc \
-p koto_runtime \
-p lib_tests \
{{args}}

test_benches:
cargo test --benches
Expand Down Expand Up @@ -54,7 +57,6 @@ test_parser:

test_release *args:
just test --release {{args}}
just test_rc --release {{args}}

test_runtime:
cargo test --package koto_runtime
Expand Down
10 changes: 2 additions & 8 deletions koto/tests/strings.koto
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,8 @@
assert not "a,b,c".ends_with(",b")

@test escape: ||
x = "
"
if os.name() == "windows"
assert_eq x.escape(), r"\r\n"
else
assert_eq x.escape(), r"\n"

assert_eq "👋".escape(), r"\u{1f44b}"
assert_eq '\r\n'.escape(), r'\r\n'
assert_eq '👋'.escape(), r'\u{1f44b}'

@test from_bytes: ||
assert_eq (string.from_bytes (72, 195, 171, 121)), "Hëy"
Expand Down
2 changes: 1 addition & 1 deletion libs/color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
2 changes: 1 addition & 1 deletion libs/geometry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
8 changes: 6 additions & 2 deletions libs/json/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ arc = ["koto_runtime/arc"]
rc = ["koto_runtime/rc"]

[dependencies]
koto_serialize = { path = "../../crates/serialize", version = "^0.14.0" }
serde_json = { workspace = true }

[dependencies.koto_runtime]
path = "../../crates/runtime"
version = "^0.14.0"
default-features = false

[dependencies.koto_serialize]
path = "../../crates/serialize"
version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
23 changes: 14 additions & 9 deletions libs/lib_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ description = "A test runner for the standard Koto libraries"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["arc"]
arc = ["koto/arc"]
rc = ["koto/rc"]

[dev-dependencies]
koto = { path = "../../crates/koto", version = "^0.14.0" }
koto_color = { path = "../color", version = "^0.14.0" }
koto_geometry = { path = "../geometry", version = "^0.14.0" }
koto_json = { path = "../json", version = "^0.14.0" }
koto_random = { path = "../random", version = "^0.14.0" }
koto_regex = { path = "../regex", version = "^0.14.0" }
koto_tempfile = { path = "../tempfile", version = "^0.14.0" }
koto_toml = { path = "../toml", version = "^0.14.0" }
koto_yaml = { path = "../yaml", version = "^0.14.0" }
koto = { path = "../../crates/koto", version = "^0.14.0", default-features = false }
koto_color = { path = "../color", version = "^0.14.0", default-features = false }
koto_geometry = { path = "../geometry", version = "^0.14.0", default-features = false }
koto_json = { path = "../json", version = "^0.14.0", default-features = false }
koto_random = { path = "../random", version = "^0.14.0", default-features = false }
koto_regex = { path = "../regex", version = "^0.14.0", default-features = false }
koto_tempfile = { path = "../tempfile", version = "^0.14.0", default-features = false }
koto_toml = { path = "../toml", version = "^0.14.0", default-features = false }
koto_yaml = { path = "../yaml", version = "^0.14.0", default-features = false }
2 changes: 1 addition & 1 deletion libs/random/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ default-features = false
getrandom = { workspace = true }

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
2 changes: 1 addition & 1 deletion libs/regex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
2 changes: 1 addition & 1 deletion libs/tempfile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
8 changes: 6 additions & 2 deletions libs/toml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ arc = ["koto_runtime/arc"]
rc = ["koto_runtime/rc"]

[dependencies]
koto_serialize = { path = "../../crates/serialize", version = "^0.14.0" }
toml = { workspace = true }

[dependencies.koto_runtime]
path = "../../crates/runtime"
version = "^0.14.0"
default-features = false

[dependencies.koto_serialize]
path = "../../crates/serialize"
version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
8 changes: 6 additions & 2 deletions libs/yaml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ arc = ["koto_runtime/arc"]
rc = ["koto_runtime/rc"]

[dependencies]
koto_serialize = { path = "../../crates/serialize", version = "^0.14.0" }
serde_yaml = { workspace = true }

[dependencies.koto_runtime]
path = "../../crates/runtime"
version = "^0.14.0"
default-features = false

[dependencies.koto_serialize]
path = "../../crates/serialize"
version = "^0.14.0"
default-features = false

[dev-dependencies]
koto_test_utils = { path = "../../crates/test_utils" }
koto_test_utils = { path = "../../crates/test_utils", default-features = false }
Loading