tests: Remove Windows/CRLF workarounds (#618)
diff --git a/tfexec/internal/e2etest/show_test.go b/tfexec/internal/e2etest/show_test.go
index a580f75..ede3826 100644
--- a/tfexec/internal/e2etest/show_test.go
+++ b/tfexec/internal/e2etest/show_test.go
@@ -7,8 +7,6 @@
 	"context"
 	"encoding/json"
 	"errors"
-	"io/ioutil"
-	"os"
 	"path/filepath"
 	"runtime"
 	"strings"
@@ -617,17 +615,7 @@
 			t.Skip("plan file created in 0.12 on Linux is not compatible with other systems")
 		}
 
-		f, err := os.Open("testdata/non_default_planfile_012/human_readable_output.txt")
-		if err != nil {
-			t.Fatal(err)
-		}
-		defer f.Close()
-		expected, err := ioutil.ReadAll(f)
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		err = tf.Init(context.Background())
+		err := tf.Init(context.Background())
 		if err != nil {
 			t.Fatalf("error running Init in test directory: %s", err)
 		}
@@ -637,7 +625,21 @@
 			t.Fatal(err)
 		}
 
-		if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(string(expected))); diff != "" {
+		expected := `An execution plan has been generated and is shown below.
+Resource actions are indicated with the following symbols:
+  + create
+
+Terraform will perform the following actions:
+
+  # null_resource.foo will be created
+  + resource "null_resource" "foo" {
+      + id = (known after apply)
+    }
+
+Plan: 1 to add, 0 to change, 0 to destroy.
+`
+
+		if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(expected)); diff != "" {
 			t.Fatalf("unexpected difference: %s", diff)
 		}
 	})
@@ -645,17 +647,7 @@
 
 func TestShowPlanFileRaw013(t *testing.T) {
 	runTestWithVersions(t, []string{testutil.Latest013}, "non_default_planfile_013", func(t *testing.T, tfv *version.Version, tf *tfexec.Terraform) {
-		f, err := os.Open("testdata/non_default_planfile_013/human_readable_output.txt")
-		if err != nil {
-			t.Fatal(err)
-		}
-		defer f.Close()
-		expected, err := ioutil.ReadAll(f)
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		err = tf.Init(context.Background())
+		err := tf.Init(context.Background())
 		if err != nil {
 			t.Fatalf("error running Init in test directory: %s", err)
 		}
@@ -665,7 +657,21 @@
 			t.Fatal(err)
 		}
 
-		if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(string(expected))); diff != "" {
+		expected := `An execution plan has been generated and is shown below.
+Resource actions are indicated with the following symbols:
+  + create
+
+Terraform will perform the following actions:
+
+  # null_resource.foo will be created
+  + resource "null_resource" "foo" {
+      + id = (known after apply)
+    }
+
+Plan: 1 to add, 0 to change, 0 to destroy.
+`
+
+		if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(expected)); diff != "" {
 			t.Fatalf("unexpected difference: %s", diff)
 		}
 	})
@@ -673,17 +679,7 @@
 
 func TestShowPlanFileRaw014(t *testing.T) {
 	runTestWithVersions(t, []string{testutil.Latest014}, "non_default_planfile_014", func(t *testing.T, tfv *version.Version, tf *tfexec.Terraform) {
-		f, err := os.Open("testdata/non_default_planfile_013/human_readable_output.txt")
-		if err != nil {
-			t.Fatal(err)
-		}
-		defer f.Close()
-		expected, err := ioutil.ReadAll(f)
-		if err != nil {
-			t.Fatal(err)
-		}
-
-		err = tf.Init(context.Background())
+		err := tf.Init(context.Background())
 		if err != nil {
 			t.Fatalf("error running Init in test directory: %s", err)
 		}
@@ -692,7 +688,22 @@
 		if err != nil {
 			t.Fatal(err)
 		}
-		if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(string(expected))); diff != "" {
+
+		expected := `An execution plan has been generated and is shown below.
+Resource actions are indicated with the following symbols:
+  + create
+
+Terraform will perform the following actions:
+
+  # null_resource.foo will be created
+  + resource "null_resource" "foo" {
+      + id = (known after apply)
+    }
+
+Plan: 1 to add, 0 to change, 0 to destroy.
+`
+
+		if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(expected)); diff != "" {
 			t.Fatalf("unexpected difference: %s", diff)
 		}
 	})
@@ -1219,8 +1230,6 @@
 func normalizePlanOutput(str string) string {
 	// Ignore any extra newlines at the beginning or end of output
 	str = strings.TrimSpace(str)
-	// Normalize CRLF to LF for cross-platform testing
-	str = strings.Replace(str, "\r\n", "\n", -1)
 
 	return str
 }
diff --git a/tfexec/internal/e2etest/testdata/.gitattributes b/tfexec/internal/e2etest/testdata/.gitattributes
index 6566631..0fd80d3 100644
--- a/tfexec/internal/e2etest/testdata/.gitattributes
+++ b/tfexec/internal/e2etest/testdata/.gitattributes
@@ -1,3 +1,7 @@
-# Always checkout state files with LF (even on Windows)
-# to match how the state is written by Terraform
+# Always checkout specific files with LF (even on Windows)
+
+# To match how the state is written by Terraform
 *.tfstate text eol=lf
+
+# To avoid byte-offset differences in diagnostics due to extra \r
+*.tf text eol=lf
diff --git a/tfexec/internal/e2etest/testdata/non_default_planfile_012/human_readable_output.txt b/tfexec/internal/e2etest/testdata/non_default_planfile_012/human_readable_output.txt
deleted file mode 100644
index de8dc74..0000000
--- a/tfexec/internal/e2etest/testdata/non_default_planfile_012/human_readable_output.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-An execution plan has been generated and is shown below.
-Resource actions are indicated with the following symbols:
-  + create
-
-Terraform will perform the following actions:
-
-  # null_resource.foo will be created
-  + resource "null_resource" "foo" {
-      + id = (known after apply)
-    }
-
-Plan: 1 to add, 0 to change, 0 to destroy.
diff --git a/tfexec/internal/e2etest/testdata/non_default_planfile_013/human_readable_output.txt b/tfexec/internal/e2etest/testdata/non_default_planfile_013/human_readable_output.txt
deleted file mode 100644
index de8dc74..0000000
--- a/tfexec/internal/e2etest/testdata/non_default_planfile_013/human_readable_output.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-An execution plan has been generated and is shown below.
-Resource actions are indicated with the following symbols:
-  + create
-
-Terraform will perform the following actions:
-
-  # null_resource.foo will be created
-  + resource "null_resource" "foo" {
-      + id = (known after apply)
-    }
-
-Plan: 1 to add, 0 to change, 0 to destroy.
diff --git a/tfexec/internal/e2etest/testdata/non_default_planfile_014/human_readable_output.txt b/tfexec/internal/e2etest/testdata/non_default_planfile_014/human_readable_output.txt
deleted file mode 100644
index de8dc74..0000000
--- a/tfexec/internal/e2etest/testdata/non_default_planfile_014/human_readable_output.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-An execution plan has been generated and is shown below.
-Resource actions are indicated with the following symbols:
-  + create
-
-Terraform will perform the following actions:
-
-  # null_resource.foo will be created
-  + resource "null_resource" "foo" {
-      + id = (known after apply)
-    }
-
-Plan: 1 to add, 0 to change, 0 to destroy.
diff --git a/tfexec/internal/e2etest/validate_test.go b/tfexec/internal/e2etest/validate_test.go
index c20417e..efd7433 100644
--- a/tfexec/internal/e2etest/validate_test.go
+++ b/tfexec/internal/e2etest/validate_test.go
@@ -72,6 +72,7 @@
 						End: tfjson.Pos{
 							Line:   1,
 							Column: 10,
+							Byte:   9,
 						},
 					},
 					Snippet: &tfjson.DiagnosticSnippet{
@@ -91,10 +92,12 @@
 						Start: tfjson.Pos{
 							Line:   5,
 							Column: 5,
+							Byte:   31,
 						},
 						End: tfjson.Pos{
 							Line:   5,
 							Column: 18,
+							Byte:   44,
 						},
 					},
 					Snippet: &tfjson.DiagnosticSnippet{
@@ -122,6 +125,7 @@
 						End: tfjson.Pos{
 							Line:   1,
 							Column: 10,
+							Byte:   9,
 						},
 					},
 				},
@@ -134,10 +138,12 @@
 						Start: tfjson.Pos{
 							Line:   5,
 							Column: 5,
+							Byte:   31,
 						},
 						End: tfjson.Pos{
 							Line:   5,
 							Column: 18,
+							Byte:   44,
 						},
 					},
 				},
@@ -149,15 +155,7 @@
 			t.Fatal(err)
 		}
 
-		// reset byte locations in actual as CRLF issues render them off between operating systems
-		cleanActual := []tfjson.Diagnostic{}
-		for _, diag := range actual.Diagnostics {
-			diag.Range.Start.Byte = 0
-			diag.Range.End.Byte = 0
-			cleanActual = append(cleanActual, diag)
-		}
-
-		if diff := cmp.Diff(expectedDiags, cleanActual); diff != "" {
+		if diff := cmp.Diff(expectedDiags, actual.Diagnostics); diff != "" {
 			t.Fatalf("diags do not match: %s", diff)
 		}
 	})