File size: 1,104 Bytes
a50881d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unittest
from test_base import BaseChunkerTest
from Chunker import CodeChunker

class TestCodeChunkerGolang(BaseChunkerTest):
    def setUp(self):
        super().setUp()
        self.code_chunker = CodeChunker(file_extension='go')

    def test_chunk_golang_simple_code(self):
        go_code = self.mock_codebase['simple.go']
        chunks, _ = self.run_chunker_test(go_code)
        self.assertGreater(len(chunks), 1)  # Ensure the code is actually chunked

    def test_chunk_golang_with_structs(self):
        go_code = self.mock_codebase['structs.go']
        chunks, _ = self.run_chunker_test(go_code)
        self.assertGreater(len(chunks), 1)

    def test_chunk_golang_with_interfaces(self):
        go_code = self.mock_codebase['interfaces.go']
        chunks, _ = self.run_chunker_test(go_code)
        self.assertGreater(len(chunks), 1)

    def test_chunk_golang_with_goroutines(self):
        go_code = self.mock_codebase['goroutines.go']
        chunks, _ = self.run_chunker_test(go_code)
        self.assertGreater(len(chunks), 1)

if __name__ == '__main__':
    unittest.main()