') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Enhance documentation for JSON loading methods and add exception handling in Iso6392Data, Iso6393Data, and Rfc5646Data classes; add tests for LanguageTag parsing and normalization with options; implement logging options tests. by ptr727 · Pull Request #71 · ptr727/LanguageTags · GitHub
Skip to content

Enhance documentation for JSON loading methods and add exception handling in Iso6392Data, Iso6393Data, and Rfc5646Data classes; add tests for LanguageTag parsing and normalization with options; implement logging options tests. - #71

Merged
ptr727 merged 1 commit into
developfrom
review1
Jan 30, 2026

Conversation

@ptr727

Copy link
Copy Markdown
Owner

No description provided.

…ling in Iso6392Data, Iso6393Data, and Rfc5646Data classes; add tests for LanguageTag parsing and normalization with options; implement logging options tests.
CopilotAI review requested due to automatic review settings January 30, 2026 04:08
@ptr727
ptr727 enabled auto-merge (squash) January 30, 2026 04:09

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the LanguageTags library by improving documentation and adding comprehensive test coverage for the logging options functionality. The changes ensure that the Options parameter overloads for parsing and normalization methods are properly tested, and the XML documentation for data loading methods is more accurate and helpful.

Changes:

  • Added comprehensive test coverage for LogOptions class with 8 new tests covering logger factory and logger configuration scenarios
  • Added test coverage for Options parameter overloads in LanguageTag parsing, TryParse, ParseAndNormalize, and LanguageTagBuilder.Normalize methods
  • Enhanced XML documentation for LoadJsonAsync methods in Iso6392Data, Iso6393Data, and Rfc5646Data to document IOException and JsonException exceptions and clarify return value semantics

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
LanguageTagsTests/LogOptionsTests.csNew test file with 8 comprehensive tests for LogOptions functionality covering factory/logger configuration and fallback behavior
LanguageTagsTests/LanguageTagTests.csAdded tests for Parse, TryParse, and ParseAndNormalize methods with Options parameter
LanguageTagsTests/LanguageTagBuilderTests.csAdded test for Normalize method with Options parameter
LanguageTagsTests/Fixture.csAdded DisableParallelDefinition collection to ensure LogOptions tests don't run in parallel (preventing test interference)
LanguageTags/Iso6392Data.csEnhanced LoadJsonAsync documentation with exception tags and clarified return value description
LanguageTags/Iso6393Data.csEnhanced LoadJsonAsync documentation with exception tags and clarified return value description
LanguageTags/Rfc5646Data.csEnhanced LoadJsonAsync documentation with exception tags and clarified return value description

@ptr727
ptr727 merged commit 2a7f00e into developJan 30, 2026
14 checks passed
@ptr727
ptr727 deleted the review1 branch January 30, 2026 04:13
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ptr727