From patchwork Tue May 2 04:11:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13228467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41A20C77B7E for ; Tue, 2 May 2023 04:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231799AbjEBELX (ORCPT ); Tue, 2 May 2023 00:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbjEBELS (ORCPT ); Tue, 2 May 2023 00:11:18 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AA0A172E for ; Mon, 1 May 2023 21:11:17 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-38dfbbfe474so861924b6e.0 for ; Mon, 01 May 2023 21:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683000676; x=1685592676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1MQiioMygkcIAq2Zy3wLLzdcwYhFysh069tboWawS1Y=; b=PmAaXt4fUfhDCP+qwzTHgb6WaDU5QP2YVENeMOYXikncBjQE7FYTo8V4D1Q/dUyulq 9MoXkdqq5BkSUY51ap80buy9BQHIaYCYrjOfZ/+4D3xZ2tNN8EJYMRjQ/CscmRfiLIDS 7uBlsYkV+o4uhLSxfDkjLzNPZcaipG+kmIHJjGSNatv2/gxZ+s3VUaGFxx9acYSJGMuO a00BW8dqZxh+OpAuNrNZgIe8LclvYm0yn8tjOgDtaHzbj/vuKKxaEAj1dWX7v3jlI8d+ GbS/634MNsd9k/SM5be6UrLJOsWfdbxHRy75zSwUCD+mVtbUUKAFpaHZyJ33IzWDdL/R Hnyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683000676; x=1685592676; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1MQiioMygkcIAq2Zy3wLLzdcwYhFysh069tboWawS1Y=; b=HqvA/Xxymk//wlDTptqmdE5+1R9mIWNOuNWOHCMgMd1xK2NTz6Is1B25Wd5xyFEA9a jUB+T4raxXPRqxHAQOKyDYBINuE/dMBWeJUPs1RjL2XLNbEh7vxeoFCePc0nE3Bo2ENK lFIMmSGJzMrUtE71aUfkPMHGCCATzIcGUVMI3fFCbBNqC04OKYc+h4Cp1KeNQExMLspv gvXkSLPBi54Py2FIa08vwUBSDJdMT5bLJUEK39nv0B/ca85RU0Zj8POzeswzJgJhshhi NowAedMcSe/H7SVCMaSBTFYm+alryI8jLNYQox4maXcvHF4m+zo6x1HObRCsh3djoIwu WW9Q== X-Gm-Message-State: AC+VfDyCCIlwlbLLS9+fSnWxOSOiVZVe70/cxUYg6p1YcCnci0xsarHV 0LUHp9XuSfiYuV+ln4NQ6bwWylYB8kk= X-Google-Smtp-Source: ACHHUZ5Gec/Z4g4lQQYHQtnpvbM7fRUlsswyJf4EVR2N3n2Ztn/S1K60qk6E6PvUpO3tbOS40Lhfzw== X-Received: by 2002:aca:f06:0:b0:38c:cdf:24f3 with SMTP id 6-20020aca0f06000000b0038c0cdf24f3mr7217710oip.49.1683000676225; Mon, 01 May 2023 21:11:16 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id p129-20020acabf87000000b00383cc29d6b2sm12077544oif.51.2023.05.01.21.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 21:11:15 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Calvin Wan , Felipe Contreras Subject: [RFC PATCH 1/3] test: add simple shared library Date: Mon, 1 May 2023 22:11:11 -0600 Message-Id: <20230502041113.103385-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230502041113.103385-1-felipe.contreras@gmail.com> References: <20230502041113.103385-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It doesn't contain anything, it's just preparation for further commits. Signed-off-by: Felipe Contreras --- .gitignore | 1 + t/Makefile | 9 +++++++++ t/lib/git.c | 1 + t/lib/git.h | 4 ++++ 4 files changed, 15 insertions(+) create mode 100644 t/lib/git.c create mode 100644 t/lib/git.h diff --git a/.gitignore b/.gitignore index e875c59054..c249487b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -237,6 +237,7 @@ *.iobj *.ipdb *.dll +*.so .vs/ Debug/ Release/ diff --git a/t/Makefile b/t/Makefile index 3e00cdd801..d85e3e661d 100644 --- a/t/Makefile +++ b/t/Makefile @@ -65,6 +65,15 @@ prove: pre-clean check-chainlint $(TEST_LINT) $(T): @echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) +lib/git.o: lib/git.c + $(QUIET_CC)$(COMPILE.c) -o $@ $< + +lib/libgit.so: CFLAGS := -fPIC -Ilib/ $(CFLAGS) +lib/libgit.so: lib/git.o + +%.so:: + $(QUIET_LINK)$(CC) -shared -o $@ $^ $(LIBS) + pre-clean: $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)' diff --git a/t/lib/git.c b/t/lib/git.c new file mode 100644 index 0000000000..40d96ee354 --- /dev/null +++ b/t/lib/git.c @@ -0,0 +1 @@ +#include diff --git a/t/lib/git.h b/t/lib/git.h new file mode 100644 index 0000000000..58a28085f5 --- /dev/null +++ b/t/lib/git.h @@ -0,0 +1,4 @@ +#ifndef GIT_H +#define GIT_H + +#endif /* GIT_H */ From patchwork Tue May 2 04:11:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13228468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A43C77B73 for ; Tue, 2 May 2023 04:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbjEBELY (ORCPT ); Tue, 2 May 2023 00:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjEBELU (ORCPT ); Tue, 2 May 2023 00:11:20 -0400 Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A16DD2114 for ; Mon, 1 May 2023 21:11:18 -0700 (PDT) Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-18b0879e0c8so2759431fac.2 for ; Mon, 01 May 2023 21:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683000677; x=1685592677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CYJGzyU0fFVsMvmSTN1q34tJ32Jvn4O4BJHU2C+Tsdk=; b=gcRA2aPB9Q+VEMai9YV7iEaj1+iKqSx8F8eH1uvdM7abORwIIvvzR4eAtYL6JnIdPG Kly9WWndD6AIQw+yVohr65k/fk1a7CR78x84u+mPawryVTjGpxNgeuLh/PgTSuttSMCm iRJsYzdqt5eDHUROLSBrrRHpdP47AuyvlqUAf3/Ig+dg02P3SJ4LnSLL9miSQtJ4vxX6 9alC4NpkvTqvPDZnLDN/J2bvq5JHdWYPEVj0wPycyKZIOGOvbseYW6du8p3ZNNY/ROan lbKBHfAoQl4wWOAfIipyxJ6Trbo8jsroAQFQjOze1TMeO8buf3y6kN6JqQKxxpcIDDHG QGSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683000677; x=1685592677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CYJGzyU0fFVsMvmSTN1q34tJ32Jvn4O4BJHU2C+Tsdk=; b=JPpgPfZOkqSp/VDZX9N73hSlsJFLXhrOdGqnIPEZybhdtaA2TYV/Or+0jDOw0WQT6m CfrGr4t0BlLKfhgw8MLIDWhmjZDGvwCkxppR6SD5U/oon+/cP4lGl4CHJTuwqHXXnsm+ goiGy2SuwHzRPXrM7dT+c9HUhdhp/V5V2ntD0clrJI4gG0D0MPTNI2umaVB1Vu1ysuKG 0xZYDOdxkzHQZJpP0TUWbpkNok+/5Oc6W0chflDt/E/QyhFIh5AONNT6AxGZC7LZvFp3 L4rHVFvFPi1HiuByF5NimUeBNm5peJtJbKU8aINYCZJTmqi7l3/whOuZ/rv0/QS70LQq COjQ== X-Gm-Message-State: AC+VfDyy/36WvCWI3ren7E6iVVGVMfT4o3BkAPNSUkpSHrhzG9PfTgwL JdTyn76FxZvCrmzFGTm6o+rksDhGb1M= X-Google-Smtp-Source: ACHHUZ6+GRtnCzyJBkjgBlkDNfHYmTQdZbdcObyDbfNgDhU+0xyG+jhhlg4W5aeDZCxF9SKNi7EiVA== X-Received: by 2002:a05:6870:9444:b0:187:796c:b5cd with SMTP id e4-20020a056870944400b00187796cb5cdmr6324834oal.23.1683000677629; Mon, 01 May 2023 21:11:17 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id h19-20020a4add93000000b0054c7a08d4casm604130oov.38.2023.05.01.21.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 21:11:17 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Calvin Wan , Felipe Contreras Subject: [RFC PATCH 2/3] test: add basic unit testing framework Date: Mon, 1 May 2023 22:11:12 -0600 Message-Id: <20230502041113.103385-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230502041113.103385-1-felipe.contreras@gmail.com> References: <20230502041113.103385-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Testing full git commands is helpful, but so it is to test specific functions, which is not easy to do from the shell, which is how the current testing framework is implemented. A much more modern way to test specific functions is to write a binding for a modern language--like Ruby--and then use that binding on a modern testing framework using the same language. This makes the testing framework much simpler, and also has the advantage that writing the Ruby bindings spots libification issues. Moreover no forks are needed, and crashes are handled nicely due to Ruby's exception handling. This is the best of all worlds. This step doesn't add any actual unit tests, simply prepares the groundwork for writing them. Signed-off-by: Felipe Contreras --- t/Makefile | 13 +++++++++ t/ruby/git.c | 7 +++++ t/ruby/testox.rb | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ t/unit-test.t | 10 +++++++ 4 files changed, 98 insertions(+) create mode 100644 t/ruby/git.c create mode 100644 t/ruby/testox.rb create mode 100644 t/unit-test.t diff --git a/t/Makefile b/t/Makefile index d85e3e661d..4fdad529ab 100644 --- a/t/Makefile +++ b/t/Makefile @@ -47,6 +47,9 @@ CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl # scripts not to run the external "chainlint.pl" script themselves CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT && +RUBY_LIBS = $(shell pkg-config --libs ruby-3.0) +RUBY_CFLAGS = $(shell pkg-config --cflags ruby-3.0) + all: $(DEFAULT_TEST_TARGET) test: pre-clean check-chainlint $(TEST_LINT) @@ -65,6 +68,13 @@ prove: pre-clean check-chainlint $(TEST_LINT) $(T): @echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) +ruby/git.o: ruby/git.c + $(QUIET_CC)$(COMPILE.c) -o $@ $< + +ruby/git.so: CFLAGS := -fPIC $(RUBY_CFLAGS) -Ilib/ $(CFLAGS) +ruby/git.so: LIBS := $(RUBY_LIBS) -Llib/ -lgit $(LIBS) +ruby/git.so: ruby/git.o | lib/libgit.so + lib/git.o: lib/git.c $(QUIET_CC)$(COMPILE.c) -o $@ $< @@ -74,6 +84,9 @@ lib/libgit.so: lib/git.o %.so:: $(QUIET_LINK)$(CC) -shared -o $@ $^ $(LIBS) +test-unit: ruby/git.so + @LD_LIBRARY_PATH=lib/ ruby -Iruby unit-test.t + pre-clean: $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)' diff --git a/t/ruby/git.c b/t/ruby/git.c new file mode 100644 index 0000000000..e75692c582 --- /dev/null +++ b/t/ruby/git.c @@ -0,0 +1,7 @@ +#include +#include + +void Init_git(void) +{ + VALUE mod = rb_define_module("Git"); +} diff --git a/t/ruby/testox.rb b/t/ruby/testox.rb new file mode 100644 index 0000000000..1cc58a3ab3 --- /dev/null +++ b/t/ruby/testox.rb @@ -0,0 +1,68 @@ +# Copyright (c) 2023 Felipe Contreras + +require 'singleton' + +class TestOxException < StandardError + attr_reader :actual, :expected + + def initialize(actual, expected) + @actual, @expected = actual, expected + end +end + +class TestOx + include Singleton + + @tests = [] + + class << self + + def add(desc, &block) + @tests << [ desc, block ] + end + + def run + success = true + + puts '1..%d' % @tests.length + + @tests.each_with_index do |(desc, block),i| + begin + instance.instance_exec(&block) + puts 'ok %d - %s' % [i + 1, desc] + rescue => e + success = false + puts 'not ok %d - %s' % [i + 1, desc] + if e.is_a?(TestOxException) + puts '# -%s' % e.expected + puts '# +%s' % e.actual + else + puts '# exception: %s' % e + end + end + end + + return success + end + + end + + def assert(string) + raise string + end + + def ok(bool) + raise TestOxException.new(bool.inspect, true) unless bool + end + + def is(actual, expected) + raise TestOxException.new(actual, expected) unless actual == expected + end + +end + +def test(*args, &block) + TestOx.add(*args, &block) +end + +at_exit { exit TestOx.run } diff --git a/t/unit-test.t b/t/unit-test.t new file mode 100644 index 0000000000..97d8a14ec3 --- /dev/null +++ b/t/unit-test.t @@ -0,0 +1,10 @@ +#!/bin/env ruby + +require 'testox' +require 'git' + +test 'basic' do + ok(true) +end + +# vim: ft=ruby From patchwork Tue May 2 04:11:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13228469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D69BCC77B7E for ; Tue, 2 May 2023 04:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbjEBEL0 (ORCPT ); Tue, 2 May 2023 00:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbjEBELW (ORCPT ); Tue, 2 May 2023 00:11:22 -0400 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DAE040D0 for ; Mon, 1 May 2023 21:11:20 -0700 (PDT) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-18b5c8c2a49so2425886fac.3 for ; Mon, 01 May 2023 21:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683000679; x=1685592679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vIOdgPocvci8gU8qii/E2cEf6qJiHwf7PCNpLURO77Q=; b=s39SThj4XJUfgLPQNfSUCND8ALAXNJrpeKoy1Tv23YO66FYm4/RwiZCBRsxliQio7p fIg4aUNdHsIws+WiyiiPexrUjBnVDar5mDkhrv7krm+v+krOiZOn7cgbC+p7BS1qw89c Y4l9LSMVC+L9FjwRTUF2afOW0hTvt1OYCC7PkeVWwbDWUxg58ZmAcwsrq4D/q2CIivZ7 Mo8mMtsJNlTFMlULavjkkSrJzjvGg7WAEcj08e6GVNVaOaaMFnfuhcbPKkDFE2xX1sTS u4AbStmDFKqWYmR9T8YgZCIGfre9fzUj1QnQKtrajEJyXuGSqdUooWqY2VCDolaM269t GqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683000679; x=1685592679; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vIOdgPocvci8gU8qii/E2cEf6qJiHwf7PCNpLURO77Q=; b=C5mee4jqy8sf3ABKnEMj187SYU4q6o+57pxXSAq3SQ0E9wBvs4cuEzUFxrVl8P/E5v rHj4N60UbhtlGfM3Il8WtduJvS9OAoGG10i9B5LaYSY76WxtJTEoHYfm326CPzmS9Iio Ij8BvJAYiWNXXZBuVbZbZE1MvIuPFKTnnI4axXbvG4NY9rhfoxspp2Tnl6CdYR86j28h PNEIsbCgG42L69ihoTY6/XoTw3y4K4PRBX6jXzL5XX19P8v2NeCRjXiZ0gtDFoIcg/2L PsWYl6aOfWNpSGI/QVmYhBn1wapkBzubf1aAnJpboA9op/xJGtEP9bZ+vVhLlR4mfb3i T0Zw== X-Gm-Message-State: AC+VfDzzW1/sSOAOmWQEQ+2dixB79yduMP+di8CXg6zg219KAlt1+qZP rDPuCmsGVUo87gK5ihUlRBchaWTRvBo= X-Google-Smtp-Source: ACHHUZ65a9Q1ENKAiG0ne0KQN1RyHQunD604RPAvHCCF1BNAWhE2wm/JmRDTEuRCwLQ07AutXI2D3g== X-Received: by 2002:a05:6870:3747:b0:187:fc0b:22e3 with SMTP id a7-20020a056870374700b00187fc0b22e3mr7247666oak.30.1683000679543; Mon, 01 May 2023 21:11:19 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id dt47-20020a0568705aaf00b0016a37572d17sm11970906oab.2.2023.05.01.21.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 21:11:18 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Calvin Wan , Felipe Contreras Subject: [RFC PATCH 3/3] test: add basic unit test Date: Mon, 1 May 2023 22:11:13 -0600 Message-Id: <20230502041113.103385-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230502041113.103385-1-felipe.contreras@gmail.com> References: <20230502041113.103385-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We simply add that function, and test that function. Signed-off-by: Felipe Contreras --- 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 --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 + +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 #include +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