Unable to use extract_objects() for Vala unit tests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.6k
- Forks
- 1.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 33
Description
The following set up generates the error:
ninja: error: 'dummy@sha/meson-generated_Test.c.o', needed by 'passing_test', missing and no known rule to make it
When generated without the test the name is build/dummy@sha/meson-generated_src_Test.c.o. The _src has been dropped from the test rule.
meson.build:
project ('vala-unit-test', 'vala', 'c' )
deps = [
dependency ('glib-2.0'),
dependency ('gobject-2.0'),
]
sources = [
'src/Test.vala',
]
lib = library ('dummy', sources: sources, dependencies: deps)
obj = lib.extract_objects ('src/Test.vala')
test = executable ('passing_test', sources: ['tests/TestShouldPass.vala'], dependencies: deps, objects: obj)
test('passing_test', test)
src/Test.vala:
class Test {
public string value = "Test";
}
tests/TestShouldPass.vala:
void main () {
var a = new Test ();
assert (a.value == "Test");
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal project in meson.build and reproduce the ninja error using src/Test.vala, tests/TestShouldPass.vala, and extract_objects(). Compare the generated object path with and without the test; done means the test target resolves the generated object and builds successfully.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100