Fix missing m.Run() in TestMain (#21341)

Backport #21340, add the missing m.Run()
This commit is contained in:
wxiaoguang 2022-10-05 12:17:16 +08:00 committed by GitHub
parent cbebcc1c26
commit 1a9ba1c65d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ package markup_test
import ( import (
"context" "context"
"io" "io"
"os"
"strings" "strings"
"testing" "testing"
@ -32,6 +33,7 @@ func TestMain(m *testing.M) {
if err := git.InitSimple(context.Background()); err != nil { if err := git.InitSimple(context.Background()); err != nil {
log.Fatal("git init failed, err: %v", err) log.Fatal("git init failed, err: %v", err)
} }
os.Exit(m.Run())
} }
func TestRender_Commits(t *testing.T) { func TestRender_Commits(t *testing.T) {
@ -336,7 +338,7 @@ func TestRender_emoji(t *testing.T) {
`<p>Some text with <span class="emoji" aria-label="grinning face with smiling eyes">😄</span><span class="emoji" aria-label="grinning face with smiling eyes">😄</span> 2 emoji next to each other</p>`) `<p>Some text with <span class="emoji" aria-label="grinning face with smiling eyes">😄</span><span class="emoji" aria-label="grinning face with smiling eyes">😄</span> 2 emoji next to each other</p>`)
test( test(
"😎🤪🔐🤑❓", "😎🤪🔐🤑❓",
`<p><span class="emoji" aria-label="smiling face with sunglasses">😎</span><span class="emoji" aria-label="zany face">🤪</span><span class="emoji" aria-label="locked with key">🔐</span><span class="emoji" aria-label="money-mouth face">🤑</span><span class="emoji" aria-label="question mark">❓</span></p>`) `<p><span class="emoji" aria-label="smiling face with sunglasses">😎</span><span class="emoji" aria-label="zany face">🤪</span><span class="emoji" aria-label="locked with key">🔐</span><span class="emoji" aria-label="money-mouth face">🤑</span><span class="emoji" aria-label="red question mark">❓</span></p>`)
// should match nothing // should match nothing
test( test(

View File

@ -6,6 +6,7 @@ package markdown_test
import ( import (
"context" "context"
"os"
"strings" "strings"
"testing" "testing"
@ -37,6 +38,7 @@ func TestMain(m *testing.M) {
if err := git.InitSimple(context.Background()); err != nil { if err := git.InitSimple(context.Background()); err != nil {
log.Fatal("git init failed, err: %v", err) log.Fatal("git init failed, err: %v", err)
} }
os.Exit(m.Run())
} }
func TestRender_StandardLinks(t *testing.T) { func TestRender_StandardLinks(t *testing.T) {