Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTs Not Running with Dependencies #734

Closed
jmh530 opened this issue Oct 22, 2019 · 2 comments
Closed

UTs Not Running with Dependencies #734

jmh530 opened this issue Oct 22, 2019 · 2 comments

Comments

@jmh530
Copy link

jmh530 commented Oct 22, 2019

The unittests for run.dlang.org do not seem to be running when there are dependencies.

I have no issue running the following code with flags -unittest -main and getting the expected result

import std.stdio : writeln;

unittest {
    writeln("here");
}

However, if I add in a library

/+dub.sdl:
dependency "mir-algorithm" version="~>3.4.19"
+/
import std.stdio : writeln;

unittest {
    writeln("here");
}

then I get the following error

/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
dmd failed with exit code 1.

Note that I tried this with multiple dependency options. I figured at this point that main is not being generated for some reason, so I remove the -main flag and add in my own main function (so now just running with the -unittest flag)

/+dub.sdl:
dependency "mir-algorithm" version="~>3.4.19"
+/
import std.stdio : writeln;

unittest {
    writeln("here");
}

void main() { }

And now it does not print anything. If I remove the dub.sdl line at the top and the dependency, then it prints the expected result.

@jmh530
Copy link
Author

jmh530 commented Apr 14, 2020

Just ran into this bug again.

/+dub.sdl:
dependency "automem" version="~>0.6.2"
+/

unittest {
    assert(0);
}

void main() { }

@jmh530
Copy link
Author

jmh530 commented Apr 14, 2020

Closed in favor of 748

@jmh530 jmh530 closed this as completed Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant