You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:30:48 UTC
[GitHub] [daffodil-vscode] Shanedell opened a new pull request #33: Unit Test CI
Shanedell opened a new pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33
- Create TypeScript unit test
- Add scripts for running the tests to package.json
- Create Github Action for running the unit tests via CI
Closes #21
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r737463200
##########
File path: src/tests/data/test.dfdl.xsd
##########
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="name">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:length value="25"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
Review comment:
On a second look, I realized that this isn't actually a valid DFDL schema. It's not defining any DFDL properties, many of which are required. So this schema should fail to compile. Are the tests not currently worrying about this, and they just make sure things execute, but not necessarily worrying about any return information? I think you mentioned somewhere else that those kinds of tests are planned for a future update?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r729834128
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Install Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 10.x
+ - run: npm install
+ - run: xvfb-run -a npm test
+ if: runner.os == 'Linux'
Review comment:
For my own curiosity, why does linux need this xvfb-run thing? Does `npm test` not work on linux?
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Install Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 10.x
+ - run: npm install
+ - run: xvfb-run -a npm test
+ if: runner.os == 'Linux'
+ - run: sbt compile headerCheck
Review comment:
This is fine for now, but this probably wants to be replaced when Rat check is added.
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
Review comment:
Please use a full version. This ensures we are locked at a specific version and updates won't break things. Dependabot will sent us pull requests to update when new versions are out. Same with the Install Node.js step.
##########
File path: src/tests/daffodil.test.ts
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as assert from 'assert'
+import * as daffodil from '../daffodil'
+
+suite('Daffodfil', () => {
+ // suite to test all functions work properly
+ suite('interfaces', () => {
+ test('DaffodilData functions properly', () => {
+ let daffodilData: daffodil.DaffodilData = {
+ bytePos1b: 100,
+ }
+
+ assert.strictEqual(100, daffodilData.bytePos1b)
+ })
+
+ test('InfosetEvent functions properly', () => {
+ let infosetEvent: daffodil.InfosetEvent = {
+ content: 'This is content',
+ mimeType: 'xml',
+ }
+
+ assert.strictEqual('This is content', infosetEvent.content)
+ assert.strictEqual('xml', infosetEvent.mimeType)
+ })
+
+ test('InfosetOutput functions properly', () => {
+ let infosetOutput: daffodil.InfosetOutput = {
+ type: 'console',
+ }
+
+ assert.strictEqual('console', infosetOutput.type)
+ })
+
+ test('BuildInfo functions properly', () => {
+ let allVersions = '1.0.0'
+ let buildInfo: daffodil.BuildInfo = {
+ version: allVersions,
+ daffodilVersion: allVersions,
+ scalaVersion: allVersions,
+ }
+
+ assert.strictEqual(allVersions, buildInfo.version)
+ assert.strictEqual(allVersions, buildInfo.daffodilVersion)
+ assert.strictEqual(allVersions, buildInfo.scalaVersion)
+ })
Review comment:
It's not clear to me what the tests in this file are testing. Seems like they just create instances of interfaces and validate that they were created correctly and that you can read the values you just set? What kind of changes would cause this to fail?
##########
File path: src/tests/data/DFDLGeneralFormat.dfdl.xsd
##########
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
Review comment:
I wouldn't recommend using this file as a test. This isn't really a schema that can be used to parse anything. Suggest something really simple, like a schema with a single xs:string element that's fixed length or something. Doesn't have to be complex.
##########
File path: src/tests/data/DFDLGeneralFormat.dfdl.xsd
##########
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
Review comment:
Missing empty lines around the URL in this copyright header.
##########
File path: src/tests/adapter.test.ts
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as assert from 'assert'
+import * as path from 'path'
+import { DebugClient } from 'vscode-debugadapter-testsupport'
+
+suite('Daffodil Debug Adapter', () => {
+ const DEBUG_ADAPTER = './out/adapter/debugAdapter.js'
+ const PROJECT_ROOT = path.join(__dirname, '../../')
+ const DATA_ROOT = path.join(PROJECT_ROOT, 'src/tests/data/')
+
+ let client: DebugClient
+
+ setup(() => {
+ client = new DebugClient('node', DEBUG_ADAPTER, 'dfdl')
+ return client.start()
+ })
+
+ teardown(() => client.stop())
+
+ suite('basic', () => {
+ test('unknown request should produce error', (done) => {
+ client
+ .send('illegal_request')
+ .then(() => {
+ done(new Error('does not report error on unknown request'))
+ })
+ .catch(() => {
+ done()
+ })
+ })
+ })
+
+ suite('initialize', () => {
+ test('should return supported features', () => {
+ return client.initializeRequest().then((response) => {
+ response.body = response.body || {}
+ assert.strictEqual(response.body.supportsConfigurationDoneRequest, true)
+ })
+ })
+
+ test("should produce error for invalid 'pathFormat'", (done) => {
+ client
+ .initializeRequest({
+ adapterID: 'dfdl',
+ linesStartAt1: true,
+ columnsStartAt1: true,
+ pathFormat: 'url',
+ })
+ .then((response) => {
+ done(
+ new Error("does not report error on invalid 'pathFormat' attribute")
+ )
+ })
+ .catch((err) => {
+ // error expected
+ done()
+ })
+ })
+ })
+
+ suite('launch', () => {
+ test('should run program to the end', () => {
+ const PROGRAM = path.join(DATA_ROOT, 'DFDLGeneralFormat.dfdl.xsd')
+
+ return Promise.all([
+ client.configurationSequence(),
+ client.launch({ program: PROGRAM }),
+ client.waitForEvent('terminated'),
+ ])
+ })
Review comment:
Is it possible to add a test that parses data using the schema? And uses the debugger to step through things, verify infoset output, etc.? That can be done later, but I assume that's the kind of tests that we'll eventually want to make sure things work as expected?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] Shanedell commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
Shanedell commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r737469065
##########
File path: src/tests/data/test.dfdl.xsd
##########
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="name">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:length value="25"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
Review comment:
Yes currently things like that are not currently worried about, those tests will be added later. The current tests for the debugger mostly focus on that it can be launched.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence merged pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence merged pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] jw3 commented on pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#issuecomment-948593849
I'm thinking this should include a check on the code formatting with both prettier and scalafmt.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r736624972
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
Review comment:
You didn't specify a specfic verison for actions/checkout or actions/setup-node. v2 could mean any version of 2.x. We've had cases where there was a minor version bump that broke our test, so we want to lock to a specific version and only update after a test. Dependapot will send us update PR's so it's mostly automated.
So for example, this should be
```
actions/checkout@v2.3.5
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] jw3 commented on pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#issuecomment-948596472
Or maybe a separate PR for that since this is titled "Unit Test CI", whichever.
The point is we should be failing on unformatted code somewhere. I'll add an issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] Shanedell commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
Shanedell commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r729857453
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Install Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 10.x
+ - run: npm install
+ - run: xvfb-run -a npm test
+ if: runner.os == 'Linux'
+ - run: sbt compile headerCheck
Review comment:
Removed the header check since as stated Rat check will be added to do this.
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
Review comment:
Specified version for the OSes, also updated the CI to test on multiple different version of node being 10, 12, 14 and 16.
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Install Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 10.x
+ - run: npm install
+ - run: xvfb-run -a npm test
+ if: runner.os == 'Linux'
Review comment:
So I believe this was added somewhere in the old repo and I did not catch it, was removed as it was unnecessary
##########
File path: src/tests/daffodil.test.ts
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as assert from 'assert'
+import * as daffodil from '../daffodil'
+
+suite('Daffodfil', () => {
+ // suite to test all functions work properly
+ suite('interfaces', () => {
+ test('DaffodilData functions properly', () => {
+ let daffodilData: daffodil.DaffodilData = {
+ bytePos1b: 100,
+ }
+
+ assert.strictEqual(100, daffodilData.bytePos1b)
+ })
+
+ test('InfosetEvent functions properly', () => {
+ let infosetEvent: daffodil.InfosetEvent = {
+ content: 'This is content',
+ mimeType: 'xml',
+ }
+
+ assert.strictEqual('This is content', infosetEvent.content)
+ assert.strictEqual('xml', infosetEvent.mimeType)
+ })
+
+ test('InfosetOutput functions properly', () => {
+ let infosetOutput: daffodil.InfosetOutput = {
+ type: 'console',
+ }
+
+ assert.strictEqual('console', infosetOutput.type)
+ })
+
+ test('BuildInfo functions properly', () => {
+ let allVersions = '1.0.0'
+ let buildInfo: daffodil.BuildInfo = {
+ version: allVersions,
+ daffodilVersion: allVersions,
+ scalaVersion: allVersions,
+ }
+
+ assert.strictEqual(allVersions, buildInfo.version)
+ assert.strictEqual(allVersions, buildInfo.daffodilVersion)
+ assert.strictEqual(allVersions, buildInfo.scalaVersion)
+ })
Review comment:
So I thought process behind the testing of the interfaces was just making sure that they could be accessed and set appropriately. The main reason this would fail is if the interface being tested is not exported.
##########
File path: src/tests/daffodil.test.ts
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as assert from 'assert'
+import * as daffodil from '../daffodil'
+
+suite('Daffodfil', () => {
+ // suite to test all functions work properly
+ suite('interfaces', () => {
+ test('DaffodilData functions properly', () => {
+ let daffodilData: daffodil.DaffodilData = {
+ bytePos1b: 100,
+ }
+
+ assert.strictEqual(100, daffodilData.bytePos1b)
+ })
+
+ test('InfosetEvent functions properly', () => {
+ let infosetEvent: daffodil.InfosetEvent = {
+ content: 'This is content',
+ mimeType: 'xml',
+ }
+
+ assert.strictEqual('This is content', infosetEvent.content)
+ assert.strictEqual('xml', infosetEvent.mimeType)
+ })
+
+ test('InfosetOutput functions properly', () => {
+ let infosetOutput: daffodil.InfosetOutput = {
+ type: 'console',
+ }
+
+ assert.strictEqual('console', infosetOutput.type)
+ })
+
+ test('BuildInfo functions properly', () => {
+ let allVersions = '1.0.0'
+ let buildInfo: daffodil.BuildInfo = {
+ version: allVersions,
+ daffodilVersion: allVersions,
+ scalaVersion: allVersions,
+ }
+
+ assert.strictEqual(allVersions, buildInfo.version)
+ assert.strictEqual(allVersions, buildInfo.daffodilVersion)
+ assert.strictEqual(allVersions, buildInfo.scalaVersion)
+ })
Review comment:
So my thought process behind the testing of the interfaces was just making sure that they could be accessed and set appropriately. The main reason this would fail is if the interface being tested is not exported.
##########
File path: src/tests/adapter.test.ts
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import * as assert from 'assert'
+import * as path from 'path'
+import { DebugClient } from 'vscode-debugadapter-testsupport'
+
+suite('Daffodil Debug Adapter', () => {
+ const DEBUG_ADAPTER = './out/adapter/debugAdapter.js'
+ const PROJECT_ROOT = path.join(__dirname, '../../')
+ const DATA_ROOT = path.join(PROJECT_ROOT, 'src/tests/data/')
+
+ let client: DebugClient
+
+ setup(() => {
+ client = new DebugClient('node', DEBUG_ADAPTER, 'dfdl')
+ return client.start()
+ })
+
+ teardown(() => client.stop())
+
+ suite('basic', () => {
+ test('unknown request should produce error', (done) => {
+ client
+ .send('illegal_request')
+ .then(() => {
+ done(new Error('does not report error on unknown request'))
+ })
+ .catch(() => {
+ done()
+ })
+ })
+ })
+
+ suite('initialize', () => {
+ test('should return supported features', () => {
+ return client.initializeRequest().then((response) => {
+ response.body = response.body || {}
+ assert.strictEqual(response.body.supportsConfigurationDoneRequest, true)
+ })
+ })
+
+ test("should produce error for invalid 'pathFormat'", (done) => {
+ client
+ .initializeRequest({
+ adapterID: 'dfdl',
+ linesStartAt1: true,
+ columnsStartAt1: true,
+ pathFormat: 'url',
+ })
+ .then((response) => {
+ done(
+ new Error("does not report error on invalid 'pathFormat' attribute")
+ )
+ })
+ .catch((err) => {
+ // error expected
+ done()
+ })
+ })
+ })
+
+ suite('launch', () => {
+ test('should run program to the end', () => {
+ const PROGRAM = path.join(DATA_ROOT, 'DFDLGeneralFormat.dfdl.xsd')
+
+ return Promise.all([
+ client.configurationSequence(),
+ client.launch({ program: PROGRAM }),
+ client.waitForEvent('terminated'),
+ ])
+ })
Review comment:
I think this could be done but I think we will want to add more tests that are similar which would be a separate step. These were mostly to get the unit tests started and the CI going then add more advanced tests later on.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence commented on pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#issuecomment-944340151
In the future, please do not squash + force-push until you have received two +1's and this is ready to merge. It makes it harder to see what updates have been made to the PR. The [Code Contributor Workflow](https://cwiki.apache.org/confluence/display/DAFFODIL/Code+Contributor+Workflow) details the process we try to follow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] jw3 commented on pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
jw3 commented on pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#issuecomment-949688061
I added #45 to track the formatting check. Since there could be a reformat of an unknown number of files involved I would recommend not including it in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r736744244
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
Review comment:
Also need to update actions/setup-node. That's at v1 but should be locked to a specific version.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] Shanedell commented on pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
Shanedell commented on pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#issuecomment-944340804
that makes sense my apologizes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] Shanedell commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
Shanedell commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r736739574
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
Review comment:
My apologies I thought you were meaning to the version of the OS being used. Just fixed this be setting `actions/checkout@v2.3.5`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] Shanedell commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
Shanedell commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r736778838
##########
File path: .github/workflows/tests.yml
##########
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+name: Unit Tests
+on:
+ push:
+ branches-ignore: [ 'dependabot/**' ]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Unit Tests
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
Review comment:
updated `uses: actions/setup-node@v1` to be `uses: actions/setup-node@v1.4.6`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [daffodil-vscode] stevedlawrence commented on a change in pull request #33: Unit Test CI
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #33:
URL: https://github.com/apache/daffodil-vscode/pull/33#discussion_r737482590
##########
File path: src/tests/data/test.dfdl.xsd
##########
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="name">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:length value="25"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
Review comment:
Ok, makes sense. Just adjust the commit with the "closed" message and I'll merge this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org