Is it possible to run a single unittest without an external library?

2021-05-09 Thread Anthony via Digitalmars-d-learn
Hello, I'm trying to setup a minimal testing process with unittest. However, I would like to run the tests of a single file to keep things fast. At the moment, it runs all unittests that are imported with a file. eg. `rdmd -I... source/foo.d` will run unittests bar.d if it is imported into

Re: How do I run multiple unittests with rdmd?

2021-03-04 Thread Anthony via Digitalmars-d-learn
On Friday, 5 March 2021 at 02:08:37 UTC, H. S. Teoh wrote: In the latter case, you could just use `rdmd -unittest -i -run main.d` (replace `main.d` with whatever source file contains main()) to automatically compile all modules including their unittests *and* run 'em all in one shot. I

How do I run multiple unittests with rdmd?

2021-03-04 Thread Anthony via Digitalmars-d-learn
Hello, I'm trying to run multiple unittest files with rdmd. So far I use `find` to just pipe in the files. Eg: time find source -name *__tests.d -exec rdmd -unittest --main -I../libprelude/source -I../libparser/source -I../libgeometry/source -Isource {} \; Is there an easier way to do

Re: tiny alternative to std library

2021-03-03 Thread Anthony via Digitalmars-d-learn
On Wednesday, 3 March 2021 at 07:23:58 UTC, Siemargl wrote: On Wednesday, 3 March 2021 at 03:52:13 UTC, Anthony Quizon wrote: On Monday, 1 March 2021 at 08:52:35 UTC, Imperatorn wrote: Having a library with bare minimum meta programming would help with this I think. I'm willing to pay the

tiny alternative to std library

2021-02-25 Thread Anthony via Digitalmars-d-learn
Hello, I noticed that importing some std libraries causes the build time to jump to around 1 - 3 secs. I started creating my own helper functions to avoid importing std for scripting and prototyping in order to keep the compile time at around 0.5 secs. I was wondering if anyone knows of

Re: How do I compose pipes?

2021-01-28 Thread Anthony via Digitalmars-d-learn
On Friday, 29 January 2021 at 03:49:38 UTC, Ali Çehreli wrote: On 1/28/21 3:45 PM, Anthony wrote: > void end(AccumulatorPipe acc) { > auto pids = acc.pids ~ P.spawnShell("cat", acc.stdout); > > foreach (pid; pids) { > P.wait(pid); > } > } > ``` > > > So now I can do

Re: How do I compose pipes?

2021-01-28 Thread Anthony via Digitalmars-d-learn
On Thursday, 28 January 2021 at 17:18:46 UTC, Ali Çehreli wrote: On 1/28/21 2:16 AM, Anthony wrote: > auto p = pipeProcess("ls"); > auto q = pipeProcess("cat", stdin = p.stdout); //it would be good to do That would work if `cat` received the *contents* of the files (and with a "-" command

How do I compose pipes?

2021-01-28 Thread Anthony via Digitalmars-d-learn
This post https://dlang.org/library/std/process/pipe.html mentions: Pipes can, for example, be used for interprocess communication by spawning a new process and passing one end of the pipe to the child, while the parent uses the other end. (See also pipeProcess and pipeShell for an easier

Re: How do I get the output of the time bash command?

2021-01-27 Thread Anthony via Digitalmars-d-learn
On Wednesday, 27 January 2021 at 09:58:18 UTC, Arafel wrote: On 27/1/21 10:35, Anthony wrote: I'm trying to read the timed output of a pipeShell command but it only results in empty output. Does anyone know why this is? ```     auto p = pipeShell("time ls");     foreach(str;

How do I get the output of the time bash command?

2021-01-27 Thread Anthony via Digitalmars-d-learn
I'm trying to read the timed output of a pipeShell command but it only results in empty output. Does anyone know why this is? ``` auto p = pipeShell("time ls"); foreach(str; p.stdout.byLine) { writefln("%s",str); } ```

Generating struct members from c structs

2020-07-01 Thread Anthony via Digitalmars-d-learn
When doing interop with a c library, is there a way to automatically generate the fields that are needed for a struct? For example, when interfacing with the lwan c library: // lwan.h struct lwan { struct lwan_trie url_map_trie; struct lwan_connection *conns; struct lwan_strbuf

Re: Program exited with code -11 when calling

2020-07-01 Thread Anthony via Digitalmars-d-learn
On Wednesday, 1 July 2020 at 05:47:16 UTC, Anthony wrote: On Wednesday, 1 July 2020 at 05:33:48 UTC, H. S. Teoh wrote: On Wed, Jul 01, 2020 at 05:04:28AM +, Anthony via Digitalmars-d-learn wrote: [...] auto str_utf8 = str.toUTF8(); bson_error_t error auto bson = bson_new_from_json(cast

Re: Program exited with code -11 when calling

2020-06-30 Thread Anthony via Digitalmars-d-learn
On Wednesday, 1 July 2020 at 05:33:48 UTC, H. S. Teoh wrote: On Wed, Jul 01, 2020 at 05:04:28AM +, Anthony via Digitalmars-d-learn wrote: [...] auto str_utf8 = str.toUTF8(); bson_error_t error auto bson = bson_new_from_json(cast(const uint8_t*)str_utf8.ptr, -1, ); I get a "Pr

Re: Linking D with C structs

2020-06-30 Thread Anthony via Digitalmars-d-learn
On Monday, 29 June 2020 at 10:44:16 UTC, kinke wrote: On Monday, 29 June 2020 at 06:29:38 UTC, Anthony wrote: What does "__initZ" refer to? Does this refer to automatic initialization like "this()"? Almost, it's the static initializer for that struct, which is omitted because you apparently

Re: Program exited with code -11 when calling

2020-06-30 Thread Anthony via Digitalmars-d-learn
On Wednesday, 1 July 2020 at 05:09:47 UTC, Cym13 wrote: On Wednesday, 1 July 2020 at 05:04:28 UTC, Anthony wrote: I'm trying to convert this c function: bson_t *bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error); Into a D function. This is my attempt: extern(C) {

Program exited with code -11 when calling

2020-06-30 Thread Anthony via Digitalmars-d-learn
I'm trying to convert this c function: bson_t *bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error); Into a D function. This is my attempt: extern(C) { struct bson_t; struct bson_error_t; bson_t* bson_new_from_json(const uint8_t* data, long len,

Linking D with C structs

2020-06-29 Thread Anthony via Digitalmars-d-learn
Hello, I'm trying to hand write some bindings to mongo-c-driver. (For learning purposes and to get the latest bindings). My binding code to convert to mongoc/mongoc.d is: = c interop file module mongoc/mongoc.d; import core.stdc.stdint; extern (c) { struct { uint domain;