Skip to content

Update PoC numbering to use PoC1, PoC2 format in tests #778

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

Merged
merged 1 commit into from
Jul 6, 2025

Conversation

hahwul
Copy link
Owner

@hahwul hahwul commented Jul 6, 2025

No description provided.

@hahwul hahwul merged commit 52bd4c4 into main Jul 6, 2025
@hahwul hahwul deleted the feat/markdown-report branch July 6, 2025 00:14
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @hahwul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the internal testing suite by standardizing the format of Proof of Concept (PoC) identifiers used in generated markdown reports. The change aims to improve consistency and readability of the test output by adopting a more explicit PoC<number> naming convention.

Highlights

  • Standardized PoC Numbering: Updated the numbering convention for Proof of Concept (PoC) identifiers within markdown report test strings from a #0, #1 format to a PoC1, PoC2 format.
  • Test Assertion Updates: Modified test assertions in internal/report/report_markdown_test.go to correctly validate the presence of the new PoC1 and PoC2 formats in the generated markdown reports.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates tests for markdown report generation to use 1-based PoC numbering (e.g., PoC1, PoC2) instead of 0-based (#0, #1). The changes correctly align the test expectations with the new format.

I have one suggestion for TestGenerateMarkdownReport_MultiplePoCs to refactor the test assertions. Using a table-driven approach would improve the test's readability and maintainability, which is idiomatic in Go testing. The proposed change also improves the clarity of failure messages.

Comment on lines +243 to 254
if !strings.Contains(report, "### PoC1") {
t.Errorf("Report does not contain PoC1")
}
if !strings.Contains(report, "<script>alert(1)</script>") {
t.Errorf("Report does not contain data for PoC #0")
t.Errorf("Report does not contain data for PoC1")
}
if !strings.Contains(report, "### PoC #1") {
t.Errorf("Report does not contain PoC #1")
if !strings.Contains(report, "### PoC2") {
t.Errorf("Report does not contain PoC2")
}
if !strings.Contains(report, "';alert(2);'") {
t.Errorf("Report does not contain data for PoC #1")
t.Errorf("Report does not contain data for PoC2")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This series of if statements can be made more readable and maintainable by using a table-driven approach, which is a common pattern in Go tests. This refactoring also allows for more descriptive error messages, making it easier to debug test failures.

Using a loop over a slice of test cases makes it clearer what is being tested and simplifies adding or removing checks in the future.

	testCases := []struct {
		substr, purpose string
	}{
		{"### PoC1", "PoC1 header"},
		{"<script>alert(1)</script>", "PoC1 data"},
		{"### PoC2", "PoC2 header"},
		{"';alert(2);'", "PoC2 data"},
	}

	for _, tc := range testCases {
		if !strings.Contains(report, tc.substr) {
			t.Errorf("report is missing %s: expected to find %q", tc.purpose, tc.substr)
		}
	}

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.

1 participant