Skip to content
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

Error when document starts with example, before the test #57

Open
aSemy opened this issue Sep 17, 2023 · 0 comments · May be fixed by #58
Open

Error when document starts with example, before the test #57

aSemy opened this issue Sep 17, 2023 · 0 comments · May be fixed by #58

Comments

@aSemy
Copy link

aSemy commented Sep 17, 2023

I have a Markdown doc that contains an example before the Knit tests begin

Here's an example of a tuple definition in TypeScript:

```typescript
type StringNumberPair = [str: string, num: number];
```

<!--- CLEAR -->
<!--- TEST_NAME TuplesTest -->
<!--- INCLUDE .*\.kt
-->

```kotlin
fun main() {
  // ...
}
```

> You can get the full code [here](./code/example/example-tuple-01.kt).

```typescript
export type SimpleTypes = [
  aString: string,
  anInt: number,
  aDouble: number | null,
  bool: boolean,
  privateMember: string,
];
```

<!--- TEST -->

When I run ./gradlew knit I get an error:

Previous test was not emitted with TEST

Cause

I believe this is caused by the CLEAR directive clearing codeLines, but not testLines

kotlinx-knit/src/Knit.kt

Lines 293 to 298 in bd8e272

CLEAR_DIRECTIVE -> {
requireSingleLine(directive)
require(directive.param.isEmpty()) { "$CLEAR_DIRECTIVE directive must not have parameters" }
codeLines.clear()
continue@mainLoop
}

Context

  • Gradle 8.3
  • Knit 0.4.0
@aSemy aSemy linked a pull request Sep 17, 2023 that will close this issue
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 a pull request may close this issue.

1 participant