Skip to content

fmt: fix interface fields/methods alignment - #22055

Merged
spytheman merged 2 commits into
vlang:masterfrom
yuyi98:fix_interface_field_align
Aug 16, 2024
Merged

spytheman merged 2 commits into
vlang:masterfrom
yuyi98:fix_interface_field_align

Conversation

@yuyi98

@yuyi98 yuyi98 commented Aug 16, 2024

Copy link
Copy Markdown
Member

This PR fix interface fields/methods alignment.

  • Fix interface fields/methods alignment.
  • Modify the related test.
interface TestRunner {
mut:
	file_test_info      VTestFileMetaInfo // filled in by generated code, before .start() is called.
	fn_test_info        VTestFnMetaInfo   // filled in by generated code, before .fn_start() is called.
	fn_assert_passes    u64               // reset this to 0 in .fn_start(), increase it in .assert_pass()
	fn_passes           u64               // increase this in .fn_pass()
	fn_fails            u64               // increase this in .fn_fails()
	total_assert_passes u64               // increase this in .assert_pass()
	total_assert_fails  u64               // increase this in .assert_fail()

	start(ntests int) // called before all tests, you can initialise private data here. ntests is the number of test functions in the _test.v file.
	finish()          // called after all tests are finished, you can print some stats if you want here.
	exit_code() int   // called right after finish(), it should return the exit code, that the test program will exit with.

	fn_start() bool // called before the start of each test_ function. Return false, if the function should be skipped.
	fn_pass()       // called after the end of each test_ function, with NO failed assertion.
	fn_fail()       // called after the end of each test_ function, with a failed assertion, *or* returning an error.
	fn_error(line_nr int, file string, mod string, fn_name string, errmsg string) // called only for `fn test_xyz() ? { return error('message') }`, before .fn_fail() is called.

	assert_pass(i &VAssertMetaInfo) // called after each `assert true`.
	assert_fail(i &VAssertMetaInfo) // called after each `assert false`.

	free() // you should free all the private data of your runner here.
}

struct VTestFileMetaInfo {
	file  string
	tests int
}

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman
spytheman merged commit 38e23a7 into vlang:master Aug 16, 2024
@yuyi98
yuyi98 deleted the fix_interface_field_align branch August 16, 2024 14:36
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

Successfully merging this pull request may close these issues.

2 participants