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

Change doc examples to be checked at compile time #10

Open
workhorsy opened this issue Jan 23, 2021 · 0 comments
Open

Change doc examples to be checked at compile time #10

workhorsy opened this issue Jan 23, 2021 · 0 comments

Comments

@workhorsy
Copy link
Owner

Change this:

/++
Adds two numbers and retuns the result

Params:
 a = First value to add
 b = Second value to add

Examples:
----
int z = add(1, 4);
----
+/

int add(int a, int b) {
	return a + b;
}

To this:

/++
Adds two numbers and retuns the result

Params:
 a = First value to add
 b = Second value to add
+/

int add(int a, int b) {
	return a + b;
}

///
unittest {
	int z = add(1, 4) ;
}

The example in the first docstring will not be verified. We can move it to a unittest and use /// to tell ddoc that it is the example.

@workhorsy workhorsy changed the title Change doc examples to checked at compile time Change doc examples to be checked at compile time Jan 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant