Giter Club home page Giter Club logo

Comments (4)

tom-tan avatar tom-tan commented on June 19, 2024

I think it is not good idea to use original main function for unittest.
The main function may read a string from the standard input.
In that case, the unittest will wait for the user input and it never stops if we use original main.

Instead of that, it is better to enclose main function in version(!unittest) block as described in the document.

import std.stdio;

version(unittest) {}
else
void main()
{
    writeln("Hello!");
}

unittest
{
    assert(1+2 == 3);
}

from flycheck-d-unittest.

tom-tan avatar tom-tan commented on June 19, 2024

I close this issue because using version(!unittest) is enough to avoid this issue.

from flycheck-d-unittest.

nordlow avatar nordlow commented on June 19, 2024

I would still like to have logic that only adds -main flag if d-main-function-regexp does not match contents of current buffer. Where can I most easily inject this without modifying flycheck.el itself?

from flycheck-d-unittest.

tom-tan avatar tom-tan commented on June 19, 2024

You can directly modify the arguments by using put function.
Here is the example to remove -main from the arguments of d-dmd-unittest checker.

(let ((checker 'd-dmd-unittest))
  (put checker :flycheck-command
       (remove "-main" (flycheck-checker-arguments checker))))

"Defining new syntax checkers" section in Flycheck website will help you to modify the arguments.

from flycheck-d-unittest.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.