summaryrefslogtreecommitdiffstats
path: root/extra/git2/tests/get_extensions.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:35 +0000
commit7e5d7eea9c580ef4b41a765bde624af431942b96 (patch)
tree2c0d9ca12878fc4525650aa4e54d77a81a07cc09 /extra/git2/tests/get_extensions.rs
parentAdding debian version 1.70.0+dfsg1-9. (diff)
downloadrustc-7e5d7eea9c580ef4b41a765bde624af431942b96.tar.xz
rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.zip
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extra/git2/tests/get_extensions.rs')
-rw-r--r--extra/git2/tests/get_extensions.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/extra/git2/tests/get_extensions.rs b/extra/git2/tests/get_extensions.rs
new file mode 100644
index 000000000..d8dd55fe0
--- /dev/null
+++ b/extra/git2/tests/get_extensions.rs
@@ -0,0 +1,16 @@
+//! Test for `get_extensions`, which reads a global state maintained by libgit2
+
+use git2::opts::get_extensions;
+use git2::Error;
+
+#[test]
+fn test_get_extensions() -> Result<(), Error> {
+ let extensions = unsafe { get_extensions() }?;
+
+ assert_eq!(extensions.len(), 2);
+ assert_eq!(extensions.get(0), Some("noop"));
+ // The objectformat extension was added in 1.6
+ assert_eq!(extensions.get(1), Some("objectformat"));
+
+ Ok(())
+}