Skip to content

Commit c59c1eb

Browse files
committed
Merge branch 'main' into 3.1.x
2 parents 1b60d0b + 3c2311b commit c59c1eb

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# DON'T MODIFY THIS WORKFLOW FILE DIRECTLY
2+
#
3+
# This workflow
4+
# - checks if the PR title is compliant
5+
# (cf. https://doctolib.atlassian.net/wiki/spaces/EE/pages/1793131314/How+to+have+a+good+PR+title)
6+
# - is force implemented in specific repositories (tier0 repository) of the organization with Terraform
7+
# - is mandatory to merge in main branch of your repo because of
8+
# https://github.com/doctolib/kube/blob/master/envs/tooling/terraform/05_github/main_rulesets.tf#L1
9+
#
10+
# For more details, read https://doctolib.atlassian.net/wiki/spaces/EE/pages/1793590015/Traceability+and+risk+assessment+for+production+changes
11+
12+
name: '[Org workflow] Check PR title'
13+
run-name: '${{ github.event.pull_request.title }}'
14+
15+
on:
16+
pull_request:
17+
branches: [master, main, staging]
18+
types: [opened, edited, reopened, synchronize, ready_for_review]
19+
merge_group:
20+
21+
permissions:
22+
pull-requests: write
23+
statuses: write
24+
repository-projects: read
25+
actions: read
26+
27+
jobs:
28+
check_pr_title:
29+
name: Check PR title
30+
if: '!github.event.pull_request.draft'
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Check PR title
34+
uses: doctolib/actions/check-pr-title@main

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ use self::c_api::{
5757
};
5858
#[cfg(target_os = "android")]
5959
use self::c_api::{CBLError, CBLInitContext, CBL_Init};
60-
#[cfg(target_os = "android")]
6160
use std::ffi::CStr;
6261

6362
//////// RE-EXPORT:
@@ -124,7 +123,11 @@ impl Drop for ListenerToken {
124123
//////// MISC. API FUNCTIONS
125124

126125
pub fn couchbase_lite_c_version() -> String {
127-
String::from_utf8_lossy(CBLITE_VERSION).to_string()
126+
CStr::from_bytes_with_nul(CBLITE_VERSION)
127+
.unwrap_or_default()
128+
.to_str()
129+
.unwrap_or_default()
130+
.to_string()
128131
}
129132

130133
/** Returns the total number of Couchbase Lite objects. Useful for leak checking. */

tests/lib_test.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![cfg(test)]
2+
3+
extern crate couchbase_lite;
4+
5+
use couchbase_lite::*;
6+
7+
#[test]
8+
fn couchbase_lite_c_version_test() {
9+
assert_eq!(couchbase_lite_c_version(), "3.0.17".to_string());
10+
}

0 commit comments

Comments
 (0)