test_common

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestDirectory

func TestDirectory(t *testing.T, folderPath string, sourceSuffix string, loadAlloyConfig bool, extraArgs []string, convert func(in []byte, extraArgs []string) ([]byte, diag.Diagnostics))

TestDirectory will execute tests for converting from a source configuration file to an Alloy configuration file for all files in a provided folder path.

For each file in the folderPath which ends with the sourceSuffix:

  1. Execute the convert func on the content of each file.
  2. Remove an Info diags from the results of calling convert in step 1.
  3. If the current filename.sourceSuffix has a matching filename.diags, read the contents of filename.diags and validate that they match in order with the diags from step 2.
  4. If the current filename.sourceSuffix has a matching filename.alloy, read the contents of filename.alloy and validate that they match the Alloy configuration generated by calling convert in step 1.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL