#+test package markdown import "core:testing" @(test) test_heading_simple :: proc(t: ^testing.T) { result := inject_heading_ids("

Hello World

") testing.expect_value(t, result, `

Hello World

`) } @(test) test_heading_dedup :: proc(t: ^testing.T) { result := inject_heading_ids("

Intro

text

Intro

") testing.expect_value(t, result, `

Intro

text

Intro

`) } @(test) test_heading_nested_html :: proc(t: ^testing.T) { result := inject_heading_ids("

With code

") testing.expect_value(t, result, `

With code

`) } @(test) test_heading_entities :: proc(t: ^testing.T) { result := inject_heading_ids("

Cats & Dogs

") testing.expect_value(t, result, `

Cats & Dogs

`) } @(test) test_heading_punctuation :: proc(t: ^testing.T) { result := inject_heading_ids("

Hello, World!

") testing.expect_value(t, result, `

Hello, World!

`) } @(test) test_heading_all_levels :: proc(t: ^testing.T) { result := inject_heading_ids("

A

B

C

D

E
F
") testing.expect_value(t, result, `

A

` + `

B

` + `

C

` + `

D

` + `
E
` + `
F
`, ) } @(test) test_heading_preserves_text :: proc(t: ^testing.T) { result := inject_heading_ids("

It is bold

") testing.expect_value(t, result, `

It is bold

`) } @(test) test_heading_non_heading_tags :: proc(t: ^testing.T) { input := "
Nav

Title


" result := inject_heading_ids(input) testing.expect_value(t, result, `
Nav

Title


`) } @(test) test_heading_existing_attrs_skipped :: proc(t: ^testing.T) { input := `

Title

` result := inject_heading_ids(input) testing.expect_value(t, result, input) } @(test) test_heading_empty :: proc(t: ^testing.T) { result := inject_heading_ids("

") testing.expect_value(t, result, `

`) } @(test) test_heading_with_surrounding_content :: proc(t: ^testing.T) { input := "

Before

Title

After

" result := inject_heading_ids(input) testing.expect_value(t, result, `

Before

Title

After

`) } @(test) test_heading_numbers :: proc(t: ^testing.T) { result := inject_heading_ids("

Chapter 12

") testing.expect_value(t, result, `

Chapter 12

`) } @(test) test_heading_triple_dedup :: proc(t: ^testing.T) { result := inject_heading_ids("

Foo

Foo

Foo

") testing.expect_value(t, result, `

Foo

` + `

Foo

` + `

Foo

`, ) }