1- //go:build linux
2-
31package system_test
42
53import (
@@ -8,75 +6,75 @@ import (
86 "pkgstats-cli/internal/system"
97)
108
11- func TestParseOSID (t * testing.T ) {
9+ func TestParseOSId (t * testing.T ) {
1210 testCases := []struct {
1311 name string
1412 content string
15- expectedOSID string
13+ expectedOSId string
1614 }{
1715 {
18- name : "should return ID from simple content" ,
16+ name : "should return Id from simple content" ,
1917 content : `
2018NAME="Test OS"
2119VERSION="1.0"
2220ID=testos
2321ID_LIKE=anotheros
2422` ,
25- expectedOSID : "testos" ,
23+ expectedOSId : "testos" ,
2624 },
2725 {
28- name : "should return ID from double-quoted syntax with whitespaces" ,
26+ name : "should return Id from double-quoted syntax with whitespaces" ,
2927 content : `
3028NAME="Test OS"
3129VERSION="1.0"
3230 ID = "testos"
3331ID_LIKE=anotheros
3432` ,
35- expectedOSID : "testos" ,
33+ expectedOSId : "testos" ,
3634 },
3735 {
38- name : "should return ID with whitespaces" ,
36+ name : "should return Id with whitespaces" ,
3937 content : `
4038NAME="Test OS"
4139VERSION="1.0"
4240 ID = testos
4341ID_LIKE=anotheros
4442` ,
45- expectedOSID : "testos" ,
43+ expectedOSId : "testos" ,
4644 },
4745 {
48- name : "should return ID from single-quoted syntax" ,
46+ name : "should return Id from single-quoted syntax" ,
4947 content : `
5048NAME="Test OS"
5149VERSION="1.0"
5250ID='testos'
5351ID_LIKE=anotheros
5452` ,
55- expectedOSID : "testos" ,
53+ expectedOSId : "testos" ,
5654 },
5755 {
58- name : "should return the last ID when duplicates exist" ,
56+ name : "should return the last Id when duplicates exist" ,
5957 content : `
6058ID=firstid
6159NAME="Test OS"
6260ID=secondid
6361VERSION="1.0"
6462ID=lastid
6563` ,
66- expectedOSID : "lastid" ,
64+ expectedOSId : "lastid" ,
6765 },
6866 {
6967 name : "should return empty string for empty content" ,
7068 content : "" ,
71- expectedOSID : "" ,
69+ expectedOSId : "" ,
7270 },
7371 {
74- name : "should return empty string for content with no ID " ,
72+ name : "should return empty string for content with no Id " ,
7573 content : `
7674NAME="Test OS"
7775VERSION="1.0"
7876` ,
79- expectedOSID : "" ,
77+ expectedOSId : "" ,
8078 },
8179 {
8280 name : "should ignore comments" ,
@@ -85,22 +83,22 @@ VERSION="1.0"
8583NAME="Test OS"
8684ID=actual
8785` ,
88- expectedOSID : "actual" ,
86+ expectedOSId : "actual" ,
8987 },
9088 {
91- name : "should handle ID with embedded equals" ,
89+ name : "should handle Id with embedded equals" ,
9290 content : `
9391ID=some=value
9492` ,
95- expectedOSID : "some=value" ,
93+ expectedOSId : "some=value" ,
9694 },
9795 }
9896
9997 for _ , tc := range testCases {
10098 t .Run (tc .name , func (t * testing.T ) {
101- osID := system .ParseOSID ([]byte (tc .content ))
102- if osID != tc .expectedOSID {
103- t .Errorf ("expected OSID %q, got %q" , tc .expectedOSID , osID )
99+ osId := system .ParseOSId ([]byte (tc .content ))
100+ if osId != tc .expectedOSId {
101+ t .Errorf ("expected OSId %q, got %q" , tc .expectedOSId , osId )
104102 }
105103 })
106104 }
0 commit comments