Skip to content

text/unstable-dedent gives wrong results with blank lines #6737

Open
@lionel-rowe

Description

@lionel-rowe

Describe the bug

text/unstable-dedent gives wrong results with blank lines.

Steps to Reproduce

import { dedent } from '@std/text/unstable-dedent'

// tabs
const s1 = dedent`
	a

	b
`

assertEquals(s1, 'a\n\nb') // fails, actually 'a\nb'

const s2 = dedent`
		a

		b
`

assertEquals(s2, 'a\n\nb') // fails, actually 'a\n\tb'

// spaces
const s3 = dedent`
 a

 b
`

assertEquals(s3, 'a\n\nb') // fails, actually 'a\nb'

const s4 = dedent`
  a

  b
`

assertEquals(s4, 'a\n\nb') // fails, actually 'a\n b'

Expected behavior

See assertions

Environment

[email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions