diff mbox series

[RFC,3/3] test: add basic unit test

Message ID 20230502041113.103385-4-felipe.contreras@gmail.com (mailing list archive)
State New, archived
Headers show
Series test: new testing framework for libification | expand

Commit Message

Felipe Contreras May 2, 2023, 4:11 a.m. UTC
We simply add that function, and test that function.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/lib/git.c   | 5 +++++
 t/lib/git.h   | 2 ++
 t/ruby/git.c  | 6 ++++++
 t/unit-test.t | 4 ++++
 4 files changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/t/lib/git.c b/t/lib/git.c
index 40d96ee354..54206171cb 100644
--- a/t/lib/git.c
+++ b/t/lib/git.c
@@ -1 +1,6 @@ 
 #include <git.h>
+
+int ok(void)
+{
+	return 1;
+}
diff --git a/t/lib/git.h b/t/lib/git.h
index 58a28085f5..dbbac9e406 100644
--- a/t/lib/git.h
+++ b/t/lib/git.h
@@ -1,4 +1,6 @@ 
 #ifndef GIT_H
 #define GIT_H
 
+int ok(void);
+
 #endif /* GIT_H */
diff --git a/t/ruby/git.c b/t/ruby/git.c
index e75692c582..e173dfe03d 100644
--- a/t/ruby/git.c
+++ b/t/ruby/git.c
@@ -1,7 +1,13 @@ 
 #include <ruby.h>
 #include <git.h>
 
+VALUE rb_ok(VALUE self)
+{
+	return RTEST(ok());
+}
+
 void Init_git(void)
 {
 	VALUE mod = rb_define_module("Git");
+	rb_define_singleton_method(mod, "ok", rb_ok, 0);
 }
diff --git a/t/unit-test.t b/t/unit-test.t
index 97d8a14ec3..27303f9c49 100644
--- a/t/unit-test.t
+++ b/t/unit-test.t
@@ -7,4 +7,8 @@  test 'basic' do
   ok(true)
 end
 
+test 'ok' do
+  ok(Git::ok())
+end
+
 # vim: ft=ruby