package nix_test

import "strings"

var instSample = map[string]string{
	"bad fields":              segmentPrefix + `instantiated 'config.sub-948ae97' ` + segmentSuffix,
	"unexpected quotes left":  segmentPrefix + `instantiated 'config.sub-948ae97' -> /n'` + segmentSuffix,
	"unexpected quotes right": segmentPrefix + `instantiated 'config.sub-948ae97' -> '/n` + segmentSuffix,
	"unexpected quotes short": segmentPrefix + `instantiated 'config.sub-948ae97' -> ''` + segmentSuffix,
	"not absolute":            segmentPrefix + `instantiated 'config.sub-948ae97' -> ' '` + segmentSuffix,
	"good segment":            segmentPrefix + segmentBody + segmentSuffix,

	"getchoo atlas":        getchooAtlasOut,
	"getchoo glados":       getchooGladosOut,
	"pluiedev pappardelle": pluiedevPappardelleOut,
}

var instWant = map[string][]string{
	"getchoo atlas":        getchooAtlasInstantiated,
	"getchoo glados":       getchooGladosInstantiated,
	"pluiedev pappardelle": pluiedevPappardelleInstantiated,
}

var collectWant = map[string][]string{
	"getchoo atlas":        getchooAtlasCollective,
	"getchoo glados":       getchooGladosCollective,
	"pluiedev pappardelle": pluiedevPappardelleCollective,
}

var drvShow = map[string][]byte{
	"getchoo atlas":        getchooAtlasShow,
	"getchoo glados":       getchooGladosShow,
	"pluiedev pappardelle": pluiedevPappardelleShow,
}

const (
	segmentPrefix = `evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/development/libraries/zlib/default.nix'
evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/fetchurl/boot.nix'
performing daemon worker op: 7
instantiated 'zlib-1.3.1.tar.gz' -> '/nix/store/gyks6vvl7x0gq214ldjhi3w4rg37nh8i-zlib-1.3.1.tar.gz.drv'
source path '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' is uncacheable
copying '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' to the store...
performing daemon worker op: 7
copied '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' to '/nix/store/96rvfw5vlv1hwwm9sdxhdkkpjyym6p2x-update-autotools-gnu-config-scripts.sh'
copied source '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' -> '/nix/store/96rvfw5vlv1hwwm9sdxhdkkpjyym6p2x-update-autotools-gnu-config-scripts.sh'
evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/by-name/gn/gnu-config/package.nix'
performing daemon worker op: 7
instantiated 'config.guess-948ae97' -> '/nix/store/bamwxswxacs3cjdcydv0z7bj22d7g2kc-config.guess-948ae97.drv'
performing daemon worker op: 7
`

	segmentBody = `instantiated 'config.sub-948ae97' -> '/nix/store/nbsdqpfzh1jlpmh95s69b3iivfcvv3lh-config.sub-948ae97.drv'`

	segmentSuffix = `
performing daemon worker op: 7
instantiated 'gnu-config-2024-01-01' -> '/nix/store/ysp83x9nrks28zkblqmnc1s1kb68dr69-gnu-config-2024-01-01.drv'
performing daemon worker op: 7
instantiated 'bootstrap-stage0-stdenv-linux' -> '/nix/store/3zilrlmq7r6rpzfd94mwss32b62yinj5-bootstrap-stage0-stdenv-linux.drv'
performing daemon worker op: 7
instantiated 'update-autotools-gnu-config-scripts-hook' -> '/nix/store/7yfwy95p6lcdpljdajs5aw10h6q0sfx0-update-autotools-gnu-config-scripts-hook.drv'
source path '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/bintools-wrapper/ld-wrapper.sh' is uncacheable
copying '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/bintools-wrapper/ld-wrapper.sh' to the store...`
)

func sampleSplitPaths(s string) []string { return strings.Split(strings.TrimSpace(s), "\n") }
