<commit_before>package pipeline

import (
	"testing"
	"github.com/docker/docker/pkg/testutil/assert"
	"fmt"
)

const foo = `
image: test-foo

jobs:
  -
    script:
      - foo
    stage: build
    allow_failure: true
  -
    script:
      - do_test
    stage: test
    allow_failure: false
`

func TestConfigParsing(t *testing.T) {
	config, err := ParseConfig([]byte(foo))
	if err != nil {
		fmt.Printf("Error: %v", err)
		t.Fail()
	}

	fmt.Printf("%+v", config)
	assert.Equal(t, len(config.Jobs), 2)
}<commit_msg>Added simple test for pipeline.ParseConfig<commit_after>package pipeline_test

import (
	"testing"
	"github.com/docker/docker/pkg/testutil/assert"
	"fmt"
	"github.com/boyvanduuren/octorunner/lib/pipeline"
)

const foo = `
image: test-foo

jobs:
  -
    script:
      - foo
      - bar
    allow_failure: true
  -
    script:
      - do_test
    image: test/image:latest
    allow_failure: false
`

func TestConfigParsing(t *testing.T) {
	config, err := pipeline.ParseConfig([]byte(foo))
	if err != nil {
		fmt.Printf("Error: %v", err)
		t.Fail()
	}

	// we should have two jobs
	assert.Equal(t, len(config.Jobs), 2)

	job1 := config.Jobs[0]
	// the first job should have two commands in the script
	assert.Equal(t, len(job1.Script), 2)
	// and they should be "foo" and "bar"
	assert.Equal(t, job1.Script[0], "foo");
	assert.Equal(t, job1.Script[1], "bar");
	// allow_failure should be true
	assert.Equal(t, job1.AllowFailure, true)
	// image should be empty
	assert.Equal(t, job1.Image, "")

	job2 := config.Jobs[1]
	// the second job should only have one command
	assert.Equal(t, len(job2.Script), 1)
	// it should equal "do_test"
	assert.Equal(t, job2.Script[0], "do_test")
	// image should be "test/image:latest"
	assert.Equal(t, job2.Image, "test/image:latest")
}
{'fraction_non_alphanumeric': 0.1510387422796182, 'fraction_numerical': 0.010668163952835485, 'mean_word_length': 3.325242718446602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '335422', 'n_tokens_mistral': 688, 'n_tokens_neox': 672, 'n_words': 157}