mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 08:25:58 +01:00
Fixed issues regarding the example Meson project.
This commit is contained in:
@@ -10,6 +10,9 @@
|
|||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
project('example-4')
|
||||||
|
|
||||||
|
unity_dep = dependency('unity', fallback : ['unity', 'unity_dep'])
|
||||||
|
|
||||||
example_dir = include_directories('.', join_paths('.', 'src'))
|
example_dir = include_directories('.', join_paths('.', 'src'))
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Example 4
|
|||||||
=========
|
=========
|
||||||
|
|
||||||
Close to the simplest possible example of Unity, using only basic features.
|
Close to the simplest possible example of Unity, using only basic features.
|
||||||
to build this example run meson setup <build dir name>.
|
to build this example run "meson setup <build dir name>".
|
||||||
|
|
||||||
Meson uses the Ninja build system to actually build the code. To start the
|
Meson uses the Ninja build system to actually build the code. To start the
|
||||||
build, simply type the following command.
|
build, simply type the following command.
|
||||||
@@ -11,4 +11,5 @@ build, simply type the following command.
|
|||||||
|
|
||||||
Meson provides native support for running tests. The command to do that is simple.
|
Meson provides native support for running tests. The command to do that is simple.
|
||||||
|
|
||||||
"meson test -C <build dir name>".
|
"meson test -C <build dir name>".
|
||||||
|
|
||||||
@@ -11,13 +11,21 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
example_src = files('ProductionCode.c', 'ProductionCode2.c')
|
a_lib = library(
|
||||||
|
'production-code-1',
|
||||||
example_lib = library(meson.project_name(),
|
'ProductionCode.c',
|
||||||
sources: example_src,
|
|
||||||
include_directories: example_dir)
|
include_directories: example_dir)
|
||||||
|
|
||||||
example_dep = declare_dependency(
|
b_lib = library(
|
||||||
version: meson.project_version(),
|
'production-code-2',
|
||||||
link_with: example_lib,
|
'ProductionCode2.c',
|
||||||
|
include_directories: example_dir)
|
||||||
|
|
||||||
|
|
||||||
|
a_dep = declare_dependency(
|
||||||
|
link_with: a_lib,
|
||||||
|
include_directories: example_dir)
|
||||||
|
|
||||||
|
b_dep = declare_dependency(
|
||||||
|
link_with: b_lib,
|
||||||
include_directories: example_dir)
|
include_directories: example_dir)
|
||||||
4
examples/example_4/subprojects/unity.wrap
Executable file
4
examples/example_4/subprojects/unity.wrap
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
[wrap-git]
|
||||||
|
directory = unity
|
||||||
|
url = https://github.com/squidfarts/Unity.git
|
||||||
|
revision = head
|
||||||
@@ -17,11 +17,6 @@ void tearDown(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void);
|
|
||||||
void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void);
|
|
||||||
void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void);
|
|
||||||
void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void);
|
|
||||||
void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void);
|
|
||||||
|
|
||||||
void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void)
|
void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,5 +20,5 @@ test_src_2 = [
|
|||||||
join_paths('..' ,'TestProductionCode2.c')
|
join_paths('..' ,'TestProductionCode2.c')
|
||||||
]
|
]
|
||||||
|
|
||||||
test('Test production code one', executable('test-1', test_src_1, dependencies: [ example_dep, unity_dep ]))
|
test('Test production code one', executable('test-1', test_src_1, dependencies: [ a_dep, unity_dep ]))
|
||||||
test('Test production code two', executable('test-2', test_src_2, dependencies: [ example_dep, unity_dep ]))
|
test('Test production code two', executable('test-2', test_src_2, dependencies: [ b_dep, unity_dep ]))
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
###################################################################################
|
|
||||||
# #
|
|
||||||
# NAME: examples/meson.build #
|
|
||||||
# #
|
|
||||||
# AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. #
|
|
||||||
# WRITTEN BY: Michael Brockus. #
|
|
||||||
# #
|
|
||||||
# License: MIT #
|
|
||||||
# #
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subdir('example_4')
|
|
||||||
@@ -77,9 +77,4 @@ subdir('src')
|
|||||||
unity_dep = declare_dependency(
|
unity_dep = declare_dependency(
|
||||||
version: meson.project_version(),
|
version: meson.project_version(),
|
||||||
link_with: unity_lib,
|
link_with: unity_lib,
|
||||||
include_directories: unity_dir)
|
include_directories: unity_dir)
|
||||||
|
|
||||||
|
|
||||||
if get_option('with_examples').enabled()
|
|
||||||
subdir('examples')
|
|
||||||
endif
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
###################################################################################
|
|
||||||
# #
|
|
||||||
# NAME: meson_options.txt #
|
|
||||||
# #
|
|
||||||
# AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. #
|
|
||||||
# WRITTEN BY: Michael Brockus. #
|
|
||||||
# #
|
|
||||||
# License: MIT #
|
|
||||||
# #
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
option('with_examples',
|
|
||||||
type: 'feature', value : 'disabled',
|
|
||||||
description: 'Enable Unity for unit testing.'
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user