Skip to content
Back to skills

Add Parser Test

ASecurity

add, write, or create a parser test in clif — patterns and pitfalls for internal/parser/cfparser_test.go

  • 13 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 20, 2026
developmentgobash

Works with

  • cli

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add cfmleditor/cfmleditor-lsp --skill add-parser-test --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Parser Test?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Parser Test
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cfmleditor-add-parser-test/badge)](https://www.skillsdirectory.com/skills/cfmleditor-add-parser-test)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-parser-test
description: add, write, or create a parser test in clif — patterns and pitfalls for internal/parser/cfparser_test.go
---

Add one or more tests to `internal/parser/cfparser_test.go` for the scenario described.

## Entry points

Choose based on what you need to assert:

| Goal | Call |
|---|---|
| Function names / args only | `ParseFunctionDefs(testURI, content)` |
| Full parse — refs, scopes, vars | `Parse(testURI, content)` |
| Parse with resolvers or other options | `ParseWithOptions(testURI, content, ParseOptions{...})` |

## ParseOptions pitfall

The resolver slice field is **`Resolvers`**, not `ComponentResolvers`:

```go
ParseWithOptions(testURI, content, ParseOptions{
    Resolvers: []Resolver{{Match: `getService("$1")`, Resolve: "services.$1", Prefix: "getService"}},
})
```

## Asserting on scoped data

Local variables and local component refs require going through `pr.Scopes[n]` (0-based, matches function order in file):

```go
pr := Parse(testURI, content)
scope := pr.Scopes[0]
fv   := pr.FuncVars(scope.Start, scope.End)             // []string of local var names
refs := pr.FuncComponentRefs(scope.Start, scope.End)    // local component refs
```

Global refs (component-scope `variables.x = createObject(...)`) → `pr.ComponentRefs`
Global variable names → `pr.GlobalVars()`
Function definitions → `pr.Funcs` or use `assertDefs(t, defs, []string{...})`

## After writing the test

Run it to confirm it passes:

```bash
go test ./internal/parser/... -run <TestName> -v
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.