зеркало из https://github.com/mozilla/scribe.git
make concat test a go test
This commit is contained in:
Родитель
a7dc9097b7
Коммит
70ccd84e7c
|
@ -0,0 +1,45 @@
|
|||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
//
|
||||
// Contributor:
|
||||
// - Aaron Meihm ameihm@mozilla.com
|
||||
|
||||
package scribe_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Used in testConcatPolicy
|
||||
var concatPolicyDoc = `
|
||||
{
|
||||
"variables": [
|
||||
{ "key": "root", "value": "./test/concat" }
|
||||
],
|
||||
|
||||
"objects": [
|
||||
{
|
||||
"object": "testfile0-content",
|
||||
"filecontent": {
|
||||
"path": "${root}",
|
||||
"file": "testfile0",
|
||||
"expression": "var = \\((\\S+), (\\S+)\\)",
|
||||
"concat": "."
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"tests": [
|
||||
{
|
||||
"test": "testfile0-noop",
|
||||
"expectedresult": true,
|
||||
"object": "testfile0-content"
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
||||
func TestConcatPolicy(t *testing.T) {
|
||||
genericTestExec(t, concatPolicyDoc)
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
TESTDIRS = concat raw import-chain tags
|
||||
TESTDIRS = raw import-chain tags
|
||||
|
||||
all:
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
all:
|
||||
|
||||
runtests: test.json
|
||||
ifndef SCRIBECMD
|
||||
$(error SCRIBECMD is undefined, tests must be ran from the root of the repository)
|
||||
endif
|
||||
$(SCRIBECMD) -e -f test.json; \
|
||||
|
||||
test.json: test-template.json
|
||||
cat test-template.json | sed 's,REPLACE_IN_MAKEFILE,$(shell pwd),' > test.json
|
||||
|
||||
clean:
|
||||
rm -f test.json
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"variables": [
|
||||
{ "key": "root", "value": "REPLACE_IN_MAKEFILE" }
|
||||
],
|
||||
|
||||
"objects": [
|
||||
{
|
||||
"object": "testfile0-content",
|
||||
"filecontent": {
|
||||
"path": "${root}",
|
||||
"file": "testfile0",
|
||||
"expression": "var = \\((\\S+), (\\S+)\\)",
|
||||
"concat": "."
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"tests": [
|
||||
{
|
||||
"test": "testfile0-noop",
|
||||
"expectedresult": true,
|
||||
"object": "testfile0-content"
|
||||
}
|
||||
]
|
||||
}
|
Загрузка…
Ссылка в новой задаче