Skip to content

Commit

Permalink
test: add MDX case
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Nov 4, 2024
1 parent d515f69 commit 0ded95c
Showing 3 changed files with 138 additions and 33 deletions.
76 changes: 44 additions & 32 deletions testdata/features/comments.feature
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
Feature: Comments
Scenario: Markdown
When I test comments for ".md"
Then the output should contain exactly:
"""
test.md:15:19:vale.Redundancy:'ACT test' is redundant
test.md:19:19:vale.Redundancy:'ACT test' is redundant
test.md:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
test.md:77:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
test.md:87:16:demo.Raw:Link "[must not use `.html`](../index.html)" must use the .md file extension.
"""

Scenario: reStructuredText
When I test comments for ".rst"
Then the output should contain exactly:
"""
test.rst:15:19:vale.Redundancy:'ACT test' is redundant
test.rst:19:19:vale.Redundancy:'ACT test' is redundant
test.rst:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
"""
Scenario: MDX
When I test comments for ".mdx"
Then the output should contain exactly:
"""
test.mdx:15:19:vale.Redundancy:'ACT test' is redundant
test.mdx:19:19:vale.Redundancy:'ACT test' is redundant
test.mdx:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
test.mdx:77:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
test.mdx:87:16:demo.Raw:Link "[must not use `.html`](../index.html)" must use the .md file extension.
"""

Scenario: AsciiDoc
When I test comments for ".adoc"
Then the output should contain exactly:
"""
test.adoc:15:19:vale.Redundancy:'ACT test' is redundant
test.adoc:19:19:vale.Redundancy:'ACT test' is redundant
test.adoc:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
"""
Scenario: Markdown
When I test comments for ".md"
Then the output should contain exactly:
"""
test.md:15:19:vale.Redundancy:'ACT test' is redundant
test.md:19:19:vale.Redundancy:'ACT test' is redundant
test.md:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
test.md:77:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
test.md:87:16:demo.Raw:Link "[must not use `.html`](../index.html)" must use the .md file extension.
"""

Scenario: Org Mode
When I test comments for ".org"
Then the output should contain exactly:
"""
test.org:17:21:vale.Redundancy:'ACT test' is redundant
"""
Scenario: reStructuredText
When I test comments for ".rst"
Then the output should contain exactly:
"""
test.rst:15:19:vale.Redundancy:'ACT test' is redundant
test.rst:19:19:vale.Redundancy:'ACT test' is redundant
test.rst:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
"""

Scenario: AsciiDoc
When I test comments for ".adoc"
Then the output should contain exactly:
"""
test.adoc:15:19:vale.Redundancy:'ACT test' is redundant
test.adoc:19:19:vale.Redundancy:'ACT test' is redundant
test.adoc:25:20:demo.Ending-Preposition:Don't end a sentence with 'of.'
"""

Scenario: Org Mode
When I test comments for ".org"
Then the output should contain exactly:
"""
test.org:17:21:vale.Redundancy:'ACT test' is redundant
"""
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
StylesPath = ../../styles
MinAlertLevel = suggestion

[*.{md,rst,org,adoc}]
[formats]
mdx = md

[*.{md,rst,org,adoc,mdx}]
BasedOnStyles = vale, demo

vale.Spelling = NO
demo.CheckLinks = NO
demo.Spellcheck = NO
demo.ZeroOccurrence = NO
demo.SentenceCaseAny = NO

[*.mdx]
CommentDelimiters = {/*, */}
87 changes: 87 additions & 0 deletions testdata/fixtures/comments/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{/* vale off */}

This is some text ACT test

This is some text ACT test

{/* vale on */}

{/* vale vale.Redundancy = NO */}

This is some text ACT test

{/* vale vale.Redundancy = YES */}

This is some text ACT test

{/* vale demo.Ending-Preposition = NO */}

This is some text ACT test. This is a sentence for.

This is a sentance of.

{/* vale demo.Ending-Preposition = YES */}

This is a sentance of.

1. Consider the following `deployment.yaml` file.

```yaml
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
```
2. few other steps.
{/* vale off */}
1. This is a sentance of.
```bash
SSH should not typically be used within containers.
Ensure that non-SSH services are not using port 22.
```
{/* vale on */}

something else.

This is a sentance of.

- Unordered list example.
{/* vale off */}
- This is a sentance of.
{/* vale on */}
- one more item.

{/* vale demo.Raw = NO */}

Internal Links [must not use `.html`](../index.html)

0 comments on commit 0ded95c

Please sign in to comment.