File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ use self::c_api::{
54
54
} ;
55
55
#[ cfg( target_os = "android" ) ]
56
56
use self :: c_api:: { CBLError , CBLInitContext , CBL_Init } ;
57
- #[ cfg( target_os = "android" ) ]
58
57
use std:: ffi:: CStr ;
59
58
60
59
//////// RE-EXPORT:
@@ -121,7 +120,11 @@ impl Drop for ListenerToken {
121
120
//////// MISC. API FUNCTIONS
122
121
123
122
pub fn couchbase_lite_c_version ( ) -> String {
124
- String :: from_utf8_lossy ( CBLITE_VERSION ) . to_string ( )
123
+ CStr :: from_bytes_with_nul ( CBLITE_VERSION )
124
+ . unwrap_or_default ( )
125
+ . to_str ( )
126
+ . unwrap_or_default ( )
127
+ . to_string ( )
125
128
}
126
129
127
130
/** Returns the total number of Couchbase Lite objects. Useful for leak checking. */
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments