/src/test/rustdoc/unindent.rs

https://gitlab.com/rust-lang/rust · Rust · 62 lines · 15 code · 7 blank · 40 comment · 0 complexity · 15cd1886a13e6bf3e5a9cf564b79760e MD5 · raw file

  1. #![crate_name = "foo"]
  2. // @has foo/struct.Example.html
  3. // @matches - '//pre[@class="rust rust-example-rendered"]' \
  4. // '(?m)let example = Example::new\(\)\n \.first\(\)\n \.second\(\)\n \.build\(\);\Z'
  5. /// ```rust
  6. /// let example = Example::new()
  7. /// .first()
  8. #[cfg_attr(not(feature = "one"), doc = " .second()")]
  9. /// .build();
  10. /// ```
  11. pub struct Example;
  12. // @has foo/struct.F.html
  13. // @matches - '//pre[@class="rust rust-example-rendered"]' \
  14. // '(?m)let example = Example::new\(\)\n \.first\(\)\n \.another\(\)\n \.build\(\);\Z'
  15. ///```rust
  16. ///let example = Example::new()
  17. /// .first()
  18. #[cfg_attr(not(feature = "one"), doc = " .another()")]
  19. /// .build();
  20. /// ```
  21. pub struct F;
  22. // @has foo/struct.G.html
  23. // @matches - '//pre[@class="rust rust-example-rendered"]' \
  24. // '(?m)let example = Example::new\(\)\n\.first\(\)\n \.another\(\)\n\.build\(\);\Z'
  25. ///```rust
  26. ///let example = Example::new()
  27. ///.first()
  28. #[cfg_attr(not(feature = "one"), doc = " .another()")]
  29. ///.build();
  30. ///```
  31. pub struct G;
  32. // @has foo/struct.H.html
  33. // @has - '//div[@class="docblock"]/p' 'no whitespace lol'
  34. ///no whitespace
  35. #[doc = " lol"]
  36. pub struct H;
  37. // @has foo/struct.I.html
  38. // @matches - '//pre[@class="rust rust-example-rendered"]' '(?m)4 whitespaces!\Z'
  39. /// 4 whitespaces!
  40. #[doc = "something"]
  41. pub struct I;
  42. // @has foo/struct.J.html
  43. // @matches - '//div[@class="docblock"]/p' '(?m)a\nno whitespace\nJust some text.\Z'
  44. ///a
  45. ///no whitespace
  46. #[doc = include_str!("unindent.md")]
  47. pub struct J;
  48. // @has foo/struct.K.html
  49. // @matches - '//pre[@class="rust rust-example-rendered"]' '(?m)4 whitespaces!\Z'
  50. ///a
  51. ///
  52. /// 4 whitespaces!
  53. ///
  54. #[doc = include_str!("unindent.md")]
  55. pub struct K;