(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestExtractVersion(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | input string |
| 13 | expected string |
| 14 | }{ |
| 15 | { |
| 16 | name: "simple version", |
| 17 | input: "3_desc.sql", |
| 18 | expected: "3", |
| 19 | }, |
| 20 | { |
| 21 | name: "version with minor", |
| 22 | input: "3.1_desc.sql", |
| 23 | expected: "3.1", |
| 24 | }, |
| 25 | { |
| 26 | name: "semantic version", |
| 27 | input: "3.1.1_desc.sql", |
| 28 | expected: "3.1.1", |
| 29 | }, |
| 30 | { |
| 31 | name: "with v prefix", |
| 32 | input: "v3.1.1_desc.sql", |
| 33 | expected: "3.1.1", |
| 34 | }, |
| 35 | { |
| 36 | name: "with V prefix", |
| 37 | input: "V3.1.1_desc.sql", |
| 38 | expected: "3.1.1", |
| 39 | }, |
| 40 | { |
| 41 | name: "with additional text", |
| 42 | input: "3.1.1_description_with_more_text.sql", |
| 43 | expected: "3.1.1", |
| 44 | }, |
| 45 | { |
| 46 | name: "with pre-release version", |
| 47 | input: "3.1.1-beta_desc.sql", |
| 48 | expected: "3.1.1", |
| 49 | }, |
| 50 | { |
| 51 | name: "with v prefix and pre-release version", |
| 52 | input: "v3.1.1-alpha_desc.sql", |
| 53 | expected: "3.1.1", |
| 54 | }, |
| 55 | { |
| 56 | name: "timestamp version", |
| 57 | input: "202101130001_desc.sql", |
| 58 | expected: "202101130001", |
| 59 | }, |
| 60 | { |
| 61 | name: "timestamp version with v prefix", |
| 62 | input: "v202101130001_desc.sql", |
| 63 | expected: "202101130001", |
| 64 | }, |
| 65 | { |
| 66 | name: "timestamp version with V prefix", |
nothing calls this directly
no test coverage detected