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

feat: basic unit and snapshot tests #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 216 additions & 34 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@
"Textual Protobuf",
"pbtxt",
"prototxt",
"textproto"
"textproto",
"textpb",
"txtpb"
],
"extensions": [
".pbtxt",
".prototxt",
".textproto"
".textproto",
".textpb",
".txtpb"
],
"configuration": "./language-configuration.json"
}
Expand Down Expand Up @@ -84,13 +88,17 @@
"format:check": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint .",
"test": "npm run format:check && npm run lint",
"test": "npm run format:check && npm run lint && npm run test:unit && npm run test:snapshot",
"test:unit": "vscode-tmgrammar-test 'tests/unit/**/*.textproto'",
"test:snapshot": "vscode-tmgrammar-snap 'tests/snap/**/*.textproto'",
"test:snapshot:update": "vscode-tmgrammar-snap --updateSnapshot 'tests/snap/**/*.textproto'",
"watch": "cross-env NODE_ENV=development npm run build -- --watch",
"vscode:prepublish": "cross-env NODE_ENV=production npm run build"
},
"dependencies": {
"highlight.js": "^10.4.1",
"markdown-it-highlightjs": "^3.4.0"
"markdown-it-highlightjs": "^3.4.0",
"vscode-tmgrammar-test": "^0.1.3"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
Expand Down
41 changes: 41 additions & 0 deletions tests/snap/example.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This is a comment
# hi there

b { c {
d: 5
}}

a {
b: {
c {
d: 1043E-04f
f: 0xfffFF00aeF
reg_scalar: 10
reg_scalar: -inf
reg_message { foo: "bar" }
[com.foo.ext.scalar]: 10
[com.foo.ext.message] { foo: "bar" }

any_value {
[type.googleapis.com/com.foo.any] { foo: "bar" }
}
nums: [
1,
2,
3,
4
],
objs: [
{ a: 1 },
{ a: 2 },
{ a: 3 },
{ a: 4 },
],
nums2: 3,
nums2: 3,
nums2: 3,
nums2: 3,
nums2: 3,
}
}
}
Loading
Loading